diff options
Diffstat (limited to 'clang')
-rw-r--r-- | clang/lib/AST/ASTContext.cpp | 2 | ||||
-rw-r--r-- | clang/test/SemaCXX/underlying_type.cpp | 6 |
2 files changed, 7 insertions, 1 deletions
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp index 9424bc3006f..5122c21c9ad 100644 --- a/clang/lib/AST/ASTContext.cpp +++ b/clang/lib/AST/ASTContext.cpp @@ -2962,7 +2962,7 @@ QualType ASTContext::getUnaryTransformType(QualType BaseType, new (*this, TypeAlignment) UnaryTransformType (BaseType, UnderlyingType, Kind, UnderlyingType->isDependentType() ? - QualType() : UnderlyingType); + QualType() : getCanonicalType(UnderlyingType)); Types.push_back(Ty); return QualType(Ty, 0); } diff --git a/clang/test/SemaCXX/underlying_type.cpp b/clang/test/SemaCXX/underlying_type.cpp index dcfaab3c8b4..7bca06bf074 100644 --- a/clang/test/SemaCXX/underlying_type.cpp +++ b/clang/test/SemaCXX/underlying_type.cpp @@ -35,3 +35,9 @@ static_assert(is_same_type<underlying_type<f>::type, char>::value, "f has the wrong underlying type in the template"); underlying_type<int>::type e; // expected-note {{requested here}} + +using uint = unsigned; +enum class foo : uint { bar }; + +static_assert(is_same_type<underlying_type<foo>::type, unsigned>::value, + "foo has the wrong underlying type"); |