forked from OSchip/llvm-project
Look through sugar when determining whether a type is a scoped enumeration
type. Patch by Stephan Bergmann! llvm-svn: 225889
This commit is contained in:
parent
a3b04cea04
commit
43d3f55072
|
@ -7546,7 +7546,7 @@ QualType Sema::CheckSubtractionOperands(ExprResult &LHS, ExprResult &RHS,
|
|||
}
|
||||
|
||||
static bool isScopedEnumerationType(QualType T) {
|
||||
if (const EnumType *ET = dyn_cast<EnumType>(T))
|
||||
if (const EnumType *ET = T->getAs<EnumType>())
|
||||
return ET->getDecl()->isScoped();
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -301,3 +301,11 @@ namespace PR18044 {
|
|||
using E::a; // ok!
|
||||
E b = a;
|
||||
}
|
||||
|
||||
namespace test11 {
|
||||
enum class E { a };
|
||||
typedef E E2;
|
||||
E2 f1() { return E::a; }
|
||||
|
||||
bool f() { return !f1(); } // expected-error {{invalid argument type 'E2' (aka 'test11::E') to unary expression}}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue