view gcc/testsuite/g++.dg/cpp0x/alias-decl-19.C @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children
line wrap: on
line source

// 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;
}