With -fms-extensions it is possible to have a non-class record that is a
template specialization cause an assertion failure via the call to
Type::getAsCXXRecordDecl. Fixes PR 24246.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@249090
91177308-0d34-0410-b5e6-
96231b3b80d8
SSIsTemplate = T->getTypeClass() == Type::TemplateSpecialization;
}
for (const auto *TI : SemaRef.getASTContext().types()) {
+ if (!TI->isClassType() && isa<TemplateSpecializationType>(TI))
+ continue;
if (CXXRecordDecl *CD = TI->getAsCXXRecordDecl()) {
CD = CD->getCanonicalDecl();
if (!CD->isDependentType() && !CD->isAnonymousStructOrUnion() &&
_Static_assert(__alignof(s1) == 8, "");
_Static_assert(__alignof(s2) == 4, "");
}
+
+namespace PR24246 {
+template <typename TX> struct A {
+ template <bool> struct largest_type_select;
+ // expected-warning@+1 {{explicit specialization of 'largest_type_select' within class scope is a Microsoft extension}}
+ template <> struct largest_type_select<false> {
+ blah x; // expected-error {{unknown type name 'blah'}}
+ };
+};
+}