int nonconst = 8; enum NonConstE : unsigned char { NCE = nonconst }; template<int = nonconst> struct NonConstT {}; void NonConstF() {
switch (nonconst) {
case nonconst: break;
}
return;
}
bool a(int n) {
constexpr char vowels[] = "aeiou";
switch (n) {
case vowels[0]:
case vowels[1]:
case vowels[2]:
case vowels[3]:
case vowels[4]:
static_assert(!vowels[5], "unexpected number of vowels");
return true;
}
return false;
}
struct S { constexpr operator int() const { return 5; } };
enum E : unsigned char { E5 = S(), E6, E10 = S() * 2, E1 = E5 / 5 };
const E e10 = E10;
template<E> struct T {};
T<e10> s10;
enum class EE { EE32 = ' ', EE65 = 'A', EE1 = (short)1, EE5 = E5 };
int b(unsigned n) {
switch (n) {
case E6:
case EE::EE32: case (int)EE::EE32:
case 1000:
case (long long)1e10: case -3: return n;
}
return 0;
}
enum class EEE : unsigned short {
a = E6,
b = EE::EE32, c = (int)EE::EE32,
d = 1000,
e = 123456, f = -3 };
template<unsigned char> using A = int;
using Int = A<E6>;
using Int = A<EE::EE32>; using Int = A<(int)EE::EE32>;
using Int = A<200>;
using Int = A<1000>; using Int = A<-3>;
template<typename T, T v> struct Val { static constexpr T value = v; };
static_assert(Val<bool, E1>::value == 1, ""); static_assert(Val<bool, '\0'>::value == 0, ""); static_assert(Val<bool, U'\1'>::value == 1, ""); static_assert(Val<bool, E5>::value == 1, "");
void noexcept_false() noexcept(false);
void noexcept_true() noexcept(true);
Val<decltype(&noexcept_false), &noexcept_true> remove_noexcept;
Val<decltype(&noexcept_true), &noexcept_false> add_noexcept;
#if __cplusplus > 201402L
#endif
using Int = A<1.0>; enum B : bool {
True = &a, False = 0.0, };
void c() {
switch (bool b = a(5)) { case 0.0f: break;
}
}
template <bool B> int f() { return B; } template int f<&S::operator int>(); template int f<(bool)&S::operator int>();
int n = Val<bool, &S::operator int>::value;
namespace NonConstLValue {
struct S {
constexpr operator int() const { return 10; }
};
S s; enum E : char { e = s };
}