[Bug libstdc++/41216] G++ failed to correctly resolve the template parameters.
paolo dot carlini at oracle dot com
gcc-bugzilla@gcc.gnu.org
Wed Sep 2 09:48:00 GMT 2009
------- Comment #6 from paolo dot carlini at oracle dot com 2009-09-02 09:48 -------
Note: probably the old behavior will be restored in 4.5 as a side effect of
other changes, but this type of code plays very risky games and even if it
compiles, can well lead to wrong runtime behavior. Thus I definitely suggest
fixing it for portability. As I said, according to the standard in order to
instantiate std::vector with Inner, Inner must be CopyConstructible, that is,
among other requirements, this type of code:
Inner inner1;
Inner inner2(inner1);
must lead to an inner2 equivalent to inner1. However, in Inner, the second line
of code above actually triggers the templatized constructor, which uses an
extractor, etc, something definitely *not* guaranteed to copy inner1. Adding to
Inner an Inner(Inner&) and an Inner(const Inner&) would for example fix it.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41216
More information about the Gcc-bugs
mailing list