This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libstdc++/41216] G++ failed to correctly resolve the template parameters.



------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]