This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/67997] New: GCC 5.2.0 fails to link std::cout overloaded functions when -std=c++11 option is used
- From: "all4sanjay at yahoo dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 16 Oct 2015 18:58:51 +0000
- Subject: [Bug c++/67997] New: GCC 5.2.0 fails to link std::cout overloaded functions when -std=c++11 option is used
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67997
Bug ID: 67997
Summary: GCC 5.2.0 fails to link std::cout overloaded functions
when -std=c++11 option is used
Product: gcc
Version: 5.2.0
Status: UNCONFIRMED
Severity: major
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: all4sanjay at yahoo dot com
Target Milestone: ---
The sample program below works fine with GCC 4.9.0 and prior versions when used
with -std=c++11 option, but it fails with GCC 5.2.0. In fact it also fails with
Clang 3.7 and Visual Studio 2015 compilers if -std=c++11 option is used. Please
see why it's failing only with 5.2.0 version.
#include <iostream>
#include <sstream>
int main ()
{
std::stringstream str2;
str2 << "std::stringstream log message";
std::cout << str2.str() << std::endl; //This line works
std::cout << str2 << std::endl; //This line fails if -std=c++11
option is used
return 0;
}
Command Line options to compile the program
Fails: $/gcc/5.2.0/bin/g++ -std=c++11 -o test test.cpp
Works: $/gcc/5.2.0/bin/g++ -o test test.cpp
Works: $/gcc/4.7.2/bin/g++ -std=c++11 -o test test.cpp
Compiler Error:
error: no match for operator<< (operand types are std::ostringstream {aka
std::__cxx11::basic_ostringstream<char>}
Thanks
Sanjay