From: Erik Pilkington Date: Mon, 23 Sep 2019 17:16:55 +0000 (+0000) Subject: NFC: Fix a poorly-written test X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e74d21633fee932bc163fbb490fdc3bbb456e574;p=clang NFC: Fix a poorly-written test The author of r364954 foolishly forgot that == binds tighter than ?: git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@372631 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/test/SemaCXX/constexpr-builtin-bit-cast.cpp b/test/SemaCXX/constexpr-builtin-bit-cast.cpp index 8f4c34744d..0a12e7eebe 100644 --- a/test/SemaCXX/constexpr-builtin-bit-cast.cpp +++ b/test/SemaCXX/constexpr-builtin-bit-cast.cpp @@ -61,13 +61,13 @@ void test_record() { constexpr int_splicer splice{0x0C05FEFE, 0xCAFEBABE}; - static_assert(bit_cast(splice) == LITTLE_END - ? 0xCAFEBABE0C05FEFE - : 0x0C05FEFECAFEBABE); + static_assert(bit_cast(splice) == (LITTLE_END + ? 0xCAFEBABE0C05FEFE + : 0x0C05FEFECAFEBABE)); - static_assert(bit_cast(0xCAFEBABE0C05FEFE).x == LITTLE_END - ? 0x0C05FEFE - : 0xCAFEBABE); + static_assert(bit_cast(0xCAFEBABE0C05FEFE).x == (LITTLE_END + ? 0x0C05FEFE + : 0xCAFEBABE)); static_assert(round_trip(splice)); static_assert(round_trip(splice)); @@ -220,7 +220,7 @@ void backtrace() { void test_array_fill() { constexpr unsigned char a[4] = {1, 2}; constexpr unsigned int i = bit_cast(a); - static_assert(i == LITTLE_END ? 0x00000201 : 0x01020000, ""); // expected-warning {{converting the result of '?:' with integer constants to a boolean always evaluates to 'true'}} + static_assert(i == (LITTLE_END ? 0x00000201 : 0x01020000)); } typedef decltype(nullptr) nullptr_t;