The following code doesn't call the copy constructor.
struct X
{
int x;
X(int num)
{
x = num;
std::cout << "ctor" << std::endl;
}
X(const X& other)
{
std::cout << "copy ctor" << std::endl;
}
};
int main(int argc, _TCHAR* argv[])
{
X* x = new X(3);
X* y(x);
}
Output:
ctor
Is it copy-ctor elision?