aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/constexpr-63265.C
blob: aa0ce5e7ce26c3311439977e76342da78415f245 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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");