http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56557
Bug #: 56557 Summary: Link error about `std::fstream' or `std::stringstream' with `-flto' and `-rdynamic' options Classification: Unclassified Product: gcc Version: 4.8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: ai.az...@gmail.com Created attachment 29605 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29605 Output of -v option The following code results in a link error when compiling on GCC 4.8.0 20130303 with `-flto' and `-rdynamic' options; //================ #include <fstream> int main() { std::fstream x; } //================ The link error is; cryolite@ubuntu:~/work/gcc-bugs/20130306$ ~/local/gcc-4.8-20130303/bin/g++ -flto -rdynamic main.cpp /usr/bin/ld: a.out: hidden symbol `_ZTCSt13basic_fstreamIcSt11char_traitsIcEE0_Sd' isn't defined /usr/bin/ld: final link failed: Bad value collect2: error: ld returned 1 exit status Other specializations of `std::basic_fstream' or `std::basic_stringstream' have the similar issue. As far as I can confirm, this problem is not reproduced with 4.6.4 20130301 or 4.7.3 20130302. Thus, this seems a regression.