diff options
Diffstat (limited to 'gcc-4.9/gcc/testsuite/g++.dg/cpp0x/alias-decl-19.C')
-rw-r--r-- | gcc-4.9/gcc/testsuite/g++.dg/cpp0x/alias-decl-19.C | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/alias-decl-19.C b/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/alias-decl-19.C new file mode 100644 index 0000000..b101cb3 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/alias-decl-19.C @@ -0,0 +1,31 @@ +// PR c++/53567 +// { dg-do compile { target c++11 } } + +template <unsigned int, bool> struct IntegerType { typedef unsigned type; }; + +template <class EnumT> +using UnderlyingEnumType = typename IntegerType<sizeof(EnumT), (EnumT(-1) > EnumT(0))>::type; + +template <class EnumT, class UnderlyingT = UnderlyingEnumType<EnumT>> +struct EnumMask +{ + constexpr EnumMask(EnumT val) : m_val(val) {} + operator EnumT() { return m_val; } + + EnumT m_val; +}; + +enum class A : unsigned { x }; + +template <class EnumT> +EnumMask<EnumT> operator ~(EnumT lhs) +{ + return EnumT(~unsigned(lhs) & unsigned(EnumT::maskAll)); // { dg-error "not a member" } + +} + +int main() +{ + ~A::x; + return 0; +} |