[Bug c++/3471] gcc 3.01 reports error about a private copy constructor that shouldn't get called.
austern at apple dot com
gcc-bugzilla@gcc.gnu.org
Tue Sep 9 18:00:00 GMT 2003
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=3471
------- Additional Comments From austern at apple dot com 2003-09-09 18:00 -------
I believe that this resolution is incorrect. f.test(b) initializes a reference of type const foo&
with a temporary, where the temporary was created via a user-defined conversion from
bar, foo::foo(bar). The last bullet item in section 8.5.3/p5 of the standard (i.e. the bullet
item just before par 6) says that the temporary is created "using the rules for a non-
reference copy initialization (8.5)". 8.5p14 says that non-reference copy initialization is
done as if by doing a user-defined conversion and then making a copy. It says that an
implementation is permitted to elide the copy constructor, referring to clause 12.2 for
details. 12.2 paragraph 1 makes it clear that even when the copy constructor is elided,
the implementation is still required to check it for accessibility.
I've opened new bug http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12226 for the failure to
check copy constructor accessibility when the copy constructor is optimized away.
More information about the Gcc-bugs
mailing list