------- Comment #1 from gcc at david dot osborn dot name 2008-06-08 19:55 ------- Created an attachment (id=15736) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=15736&action=view) reduced testcase
This bug still exists in GCC 4.3.1. I've narrowed it down to line 183 in bits/basic_ios.tcc where it says: extern template class basic_ios<char>; If you comment out this line, the code produces the correct result (12345). Otherwise it produced zero consistently. The attached testcase leaves a lot out of the iostream classes, so it may be technically invalid. But it yields that same results as the previous testcase, as well as with respect to the "extern template" line. Also, the std::vector in the original testcase can be replaced by an empty class with an explicit destructor. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30047