Possible duplicate:
std :: string x (x);
class A {}; int main() { A a(a); }
It compiles.
gcc (GCC) 4.7.2 20120921 (Red Hat 4.7.2-2)
g++ -o main main.cpp -Wall -w -ansi
I do not receive any warnings.
Why does this look like valid C ++?
Is it mentioned anywhere in the standard?
Are there any warning flags that can report this to gcc?
When a class has member data, the data ends up random.
Example:
: -482728464
What's going on here? Also, how can I prevent this from happening accidentally? - Is it possible to make a compiler error?
c ++ copy-constructor class member
Trevor hickey
source share