aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/alias-decl-19.C
blob: b101cb3b7fbfdc6e21134b35196bc86011b08d50 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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;
}