https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64571
Bug ID: 64571 Summary: [5.0 Regression] Link failure with fstream due to new string implementation Product: gcc Version: 5.0 Status: UNCONFIRMED Keywords: rejects-valid Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: reichelt at gcc dot gnu.org CC: redi at gcc dot gnu.org The following valid program (compiled with -std=c++11) fails to link using trunk since 2014-12-19: ======================================= #include <fstream> int main() { const std::string s = "MyFile.txt"; std::fstream fs1(s); fs1.close(); fs1.open(s); fs1.close(); std::ifstream fs2(s); fs2.close(); fs2.open(s); fs2.close(); std::ofstream fs3(s); fs3.close(); fs3.open(s); fs3.close(); return 0; } ======================================= /tmp/ccSD2wgR.o: In function `main': StringBug.cc:(.text+0x62): undefined reference to `std::basic_fstream<char, std::char_traits<char> >::basic_fstream(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::_Ios_Openmode)' StringBug.cc:(.text+0x9b): undefined reference to `std::basic_fstream<char, std::char_traits<char> >::open(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::_Ios_Openmode)' StringBug.cc:(.text+0xb9): undefined reference to `std::basic_ifstream<char, std::char_traits<char> >::basic_ifstream(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::_Ios_Openmode)' StringBug.cc:(.text+0xe6): undefined reference to `std::basic_ifstream<char, std::char_traits<char> >::open(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::_Ios_Openmode)' StringBug.cc:(.text+0x110): undefined reference to `std::basic_ofstream<char, std::char_traits<char> >::basic_ofstream(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::_Ios_Openmode)' StringBug.cc:(.text+0x149): undefined reference to `std::basic_ofstream<char, std::char_traits<char> >::open(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::_Ios_Openmode)' collect2: error: ld returned 1 exit status This is related to PR64422 and PR64449.