[libcxxabi] r293813 - Merging r292638:

Hans Wennborg via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 1 13:30:36 PST 2017


Author: hans
Date: Wed Feb  1 15:30:36 2017
New Revision: 293813

URL: http://llvm.org/viewvc/llvm-project?rev=293813&view=rev
Log:
Merging r292638:
------------------------------------------------------------------------
r292638 | ericwf | 2017-01-20 11:34:19 -0800 (Fri, 20 Jan 2017) | 9 lines

Fix catch_reference_nullptr.pass.cpp test for GCC.

This test contained an implicit conversion from nullptr to bool.
Clang warns about this but the test had supressed that warning.
However GCC diagnoses the same code as an error and requires
-fpermissive to accept it.

This patch fixes both the warning and the error by explicitly
converting the pointer to bool.
------------------------------------------------------------------------

Modified:
    libcxxabi/branches/release_40/   (props changed)
    libcxxabi/branches/release_40/test/catch_reference_nullptr.pass.cpp

Propchange: libcxxabi/branches/release_40/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Feb  1 15:30:36 2017
@@ -1 +1 @@
-/libcxxabi/trunk:292135,292418
+/libcxxabi/trunk:292135,292418,292638

Modified: libcxxabi/branches/release_40/test/catch_reference_nullptr.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/branches/release_40/test/catch_reference_nullptr.pass.cpp?rev=293813&r1=293812&r2=293813&view=diff
==============================================================================
--- libcxxabi/branches/release_40/test/catch_reference_nullptr.pass.cpp (original)
+++ libcxxabi/branches/release_40/test/catch_reference_nullptr.pass.cpp Wed Feb  1 15:30:36 2017
@@ -12,12 +12,6 @@
 #include <cassert>
 #include <cstdlib>
 
-// Clang emits a warning on converting an object of type nullptr_t to bool,
-// even in generic code. Suppress it.
-#if defined(__clang__)
-#pragma clang diagnostic ignored "-Wnull-conversion"
-#endif
-
 struct A {};
 
 template<typename T, bool CanCatchNullptr>
@@ -25,7 +19,7 @@ static void catch_nullptr_test() {
   try {
     throw nullptr;
   } catch (T &p) {
-    assert(CanCatchNullptr && !p);
+    assert(CanCatchNullptr && !static_cast<bool>(p));
   } catch (...) {
     assert(!CanCatchNullptr);
   }




More information about the cfe-commits mailing list