[libcxxabi] r292638 - Fix catch_reference_nullptr.pass.cpp test for GCC.
Eric Fiselier via cfe-commits
cfe-commits at lists.llvm.org
Fri Jan 20 11:46:42 PST 2017
This patch fixes a libc++abi test failure when compiled with GCC 5, 6, or 7.
We should merge this into 4.0 to help get `check-all` clean.
/Eric
On Fri, Jan 20, 2017 at 12:34 PM, Eric Fiselier via cfe-commits <
cfe-commits at lists.llvm.org> wrote:
> Author: ericwf
> Date: Fri Jan 20 13:34:19 2017
> New Revision: 292638
>
> URL: http://llvm.org/viewvc/llvm-project?rev=292638&view=rev
> Log:
> 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/trunk/test/catch_reference_nullptr.pass.cpp
>
> Modified: libcxxabi/trunk/test/catch_reference_nullptr.pass.cpp
> URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/test/
> catch_reference_nullptr.pass.cpp?rev=292638&r1=292637&r2=292638&view=diff
> ============================================================
> ==================
> --- libcxxabi/trunk/test/catch_reference_nullptr.pass.cpp (original)
> +++ libcxxabi/trunk/test/catch_reference_nullptr.pass.cpp Fri Jan 20
> 13:34:19 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);
> }
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170120/f15ec1fa/attachment.html>
More information about the cfe-commits
mailing list