diff --git a/clang/lib/AST/Type.cpp b/clang/lib/AST/Type.cpp --- a/clang/lib/AST/Type.cpp +++ b/clang/lib/AST/Type.cpp @@ -1801,6 +1801,9 @@ } // Only these types can contain the desired 'auto' type. + Type *VisitSubstTemplateTypeParmType(const SubstTemplateTypeParmType *T) { + return Visit(T->getReplacementType()); + } Type *VisitElaboratedType(const ElaboratedType *T) { return Visit(T->getNamedType()); diff --git a/clang/test/SemaCXX/crash-auto-36064.cpp b/clang/test/SemaCXX/crash-auto-36064.cpp new file mode 100644 --- /dev/null +++ b/clang/test/SemaCXX/crash-auto-36064.cpp @@ -0,0 +1,8 @@ +// RUN: %clang_cc1 -fsyntax-only -std=c++11 %s -verify +template // expected-error{{new expression for type 'auto' requires a constructor argument}} +struct b; +struct d { + static auto c = ; // expected-error{{expected expression}} + decltype(b); // expected-error{{expected '(' for function-style cast or type construction}} + // expected-note@-1{{while substituting prior template arguments into non-type template parameter [with A = auto]}} +};