diff mbox

Alter libstdc++ test to work after c++/67216 fix

Message ID 20150818124149.GD27791@redhat.com
State New
Headers show

Commit Message

Jonathan Wakely Aug. 18, 2015, 12:41 p.m. UTC
With Paolo's fix the use of the safe-bool idiom in this test no longer
compiles in C++11 or C++14. The requirement in TR1 is that it works
"in a boolean context" and p1 == false is not necessarily a boolean
context. Do an explicit conversion to make it valid in all modes.

Tested powerpc64le-linux, committing to trunk.

Comments

Paolo Carlini Aug. 18, 2015, 12:49 p.m. UTC | #1
Hi,

On 08/18/2015 02:41 PM, Jonathan Wakely wrote:
> With Paolo's fix the use of the safe-bool idiom in this test no longer
> compiles in C++11 or C++14. The requirement in TR1 is that it works
> "in a boolean context" and p1 == false is not necessarily a boolean
> context. Do an explicit conversion to make it valid in all modes.
Thanks Jon and sorry about the breakage!

Paolo.
diff mbox

Patch

commit 78c8f95718d21c97653a61ba93ca3c311ca21bc7
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Tue Aug 18 13:17:50 2015 +0100

    	PR c++/67216
    	* testsuite/tr1/2_general_utilities/shared_ptr/observers/bool_conv.cc:
    	Fix use of safe-bool idiom that isn't valid in C++11.

diff --git a/libstdc++-v3/testsuite/tr1/2_general_utilities/shared_ptr/observers/bool_conv.cc b/libstdc++-v3/testsuite/tr1/2_general_utilities/shared_ptr/observers/bool_conv.cc
index 0c93f36..e7cefaf 100644
--- a/libstdc++-v3/testsuite/tr1/2_general_utilities/shared_ptr/observers/bool_conv.cc
+++ b/libstdc++-v3/testsuite/tr1/2_general_utilities/shared_ptr/observers/bool_conv.cc
@@ -31,9 +31,9 @@  test01()
   bool test __attribute__((unused)) = true;
 
   const std::tr1::shared_ptr<A> p1;
-  VERIFY( p1 == false );
+  VERIFY( bool(p1) == false );
   const std::tr1::shared_ptr<A> p2(p1);
-  VERIFY( p2 == false );
+  VERIFY( bool(p2) == false );
 
   return 0;
 }