J
jg
For the following case:
#include <stdio.h>
class A {
public:
A() { printf("%p A()\n", this); }
~A() { printf("%p ~A()\n", this); }
A (A& a) { printf("%p A(A&)\n", this); }
};
int main ()
{
({A a; a;});
}
Does C++ stardard require A's copy constructor be invoked (for a
temporary) ?
If so, which part of Standard requires it ?
By the way, g++ gives the following:
0xbfda64e0 A()
0xbfda64f0 A(A&)
0xbfda64e0 ~A()
0xbfda64f0 ~A()
JG
#include <stdio.h>
class A {
public:
A() { printf("%p A()\n", this); }
~A() { printf("%p ~A()\n", this); }
A (A& a) { printf("%p A(A&)\n", this); }
};
int main ()
{
({A a; a;});
}
Does C++ stardard require A's copy constructor be invoked (for a
temporary) ?
If so, which part of Standard requires it ?
By the way, g++ gives the following:
0xbfda64e0 A()
0xbfda64f0 A(A&)
0xbfda64e0 ~A()
0xbfda64f0 ~A()
JG