diff options
Diffstat (limited to 'gcc-4.9/gcc/testsuite/g++.dg/cpp0x/constexpr-63265.C')
-rw-r--r-- | gcc-4.9/gcc/testsuite/g++.dg/cpp0x/constexpr-63265.C | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/constexpr-63265.C b/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/constexpr-63265.C new file mode 100644 index 0000000..aa0ce5e --- /dev/null +++ b/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/constexpr-63265.C @@ -0,0 +1,19 @@ +// PR c++/63265 +// { dg-do compile { target c++11 } } + +#define LSHIFT (sizeof(unsigned int) * __CHAR_BIT__) + +template <int lshift> +struct SpuriouslyWarns1 { + static constexpr unsigned int v = lshift < LSHIFT ? 1U << lshift : 0; +}; + +static_assert(SpuriouslyWarns1<LSHIFT>::v == 0, "Impossible occurred"); + +template <int lshift> +struct SpuriouslyWarns2 { + static constexpr bool okay = lshift < LSHIFT; + static constexpr unsigned int v = okay ? 1U << lshift : 0; +}; + +static_assert(SpuriouslyWarns2<LSHIFT>::v == 0, "Impossible occurred"); |