Question about use of C++ copy constructor

2006-03-13 Thread Ian Lance Taylor
When I compile the attached test case with mainline, I get this: foo.cc: In function ‘void foo(const B&)’: foo.cc:3: error: ‘B::B(const B&)’ is private foo.cc:13: error: within this context I don't understand why, as I don't see the copy constructor being used anywhere. It seems to me this code

Re: Question about use of C++ copy constructor

2006-03-13 Thread David Fang
Hi, Didn't see a reply yet, so I'll chime in. The relevant text appears in gcc-3.4's release notes: "When binding an rvalue of class type to a reference, the copy constructor of the class must be accessible." PR 12226 seems to be the mother bug related to this (many dupes). Fang > foo.c

Re: Question about use of C++ copy constructor

2006-03-13 Thread Howard Hinnant
Also see CWG issue 391: http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#391 which will make our behavior non-conforming in C++0X. -Howard On Mar 13, 2006, at 4:02 PM, David Fang wrote: Hi, Didn't see a reply yet, so I'll chime in. The relevant text appears in gcc-3.4's

Re: Question about use of C++ copy constructor

2006-03-13 Thread Ian Lance Taylor
David Fang <[EMAIL PROTECTED]> writes: > The relevant text appears in gcc-3.4's release notes: > "When binding an rvalue of class type to a reference, the copy constructor > of the class must be accessible." Thanks. I see that I have managed to ask about a "frequently reported bug." Sorry about