This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/41216] G++ failed to correctly resolve the template parameters.
- From: "paolo dot carlini at oracle dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 2 Sep 2009 09:48:01 -0000
- Subject: [Bug libstdc++/41216] G++ failed to correctly resolve the template parameters.
- References: <bug-41216-18138@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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