PR56193 - Wrong test operator for basic_ios in C++11.

From-SVN: r195849
This commit is contained in:
Edward Smith-Rowland 2013-02-07 14:27:45 +00:00 committed by Edward Smith-Rowland
parent 3e50813114
commit fcf0430bda
3 changed files with 26 additions and 0 deletions

View File

@ -1,3 +1,9 @@
2013-02-06 Edward Smith-Rowland <3dw4rd@verizon.net>
* include/bits/basic_ios.h: Replace operator void*() const
with explicit operator bool() const in C++11 and greater.
* testsuite/27_io/basic_ios/pr56193.cc: New file.
2013-02-04 Dodji Seketeli <dodji@redhat.com>
Add missing explicit instantiation for std::lower_bound template

View File

@ -112,8 +112,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* This allows you to write constructs such as
* <code>if (!a_stream) ...</code> and <code>while (a_stream) ...</code>
*/
#if __cplusplus >= 201103L
explicit operator bool() const
{ return !this->fail(); }
#else
operator void*() const
{ return this->fail() ? 0 : const_cast<basic_ios*>(this); }
#endif
bool
operator!() const

View File

@ -0,0 +1,15 @@
// { dg-do compile }
// { dg-options "-std=gnu++11" }
// Copyright (C) 2013 Free Software Foundation, Inc.
#include <iostream>
// PR libstdc++/56193
int
test01()
{
std::cout << std::cout; // { dg-error "cannot bind" }
}
// { dg-error "initializing argument" "" { target *-*-* } 602 }