public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/67997] New: GCC 5.2.0 fails to link std::cout overloaded functions when -std=c++11 option is used
@ 2015-10-16 18:58 all4sanjay at yahoo dot com
  2015-10-16 20:22 ` [Bug c++/67997] " glisse at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: all4sanjay at yahoo dot com @ 2015-10-16 18:58 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug c++/67997] GCC 5.2.0 fails to link std::cout overloaded functions when -std=c++11 option is used
  2015-10-16 18:58 [Bug c++/67997] New: GCC 5.2.0 fails to link std::cout overloaded functions when -std=c++11 option is used all4sanjay at yahoo dot com
@ 2015-10-16 20:22 ` glisse at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: glisse at gcc dot gnu.org @ 2015-10-16 20:22 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67997

Marc Glisse <glisse at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |INVALID

--- Comment #1 from Marc Glisse <glisse at gcc dot gnu.org> ---
Well, yes, the standard changed, streams now have an explicit conversion to
bool instead of a hackish conversion to void*. What do you mean by "work fine",
is your goal really to print some random pointer?


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-10-16 20:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-16 18:58 [Bug c++/67997] New: GCC 5.2.0 fails to link std::cout overloaded functions when -std=c++11 option is used all4sanjay at yahoo dot com
2015-10-16 20:22 ` [Bug c++/67997] " glisse at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).