This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rG8ada884cbc2f: SubstTemplateTypeParmType can contain an 'auto' type in their replacement type (authored by serge-sans-paille).
Changed prior to commit: https://reviews.llvm.org/D106093?vs=359101&id=359293#toc Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D106093/new/ https://reviews.llvm.org/D106093 Files: clang/lib/AST/Type.cpp clang/test/SemaCXX/crash-auto-36064.cpp Index: clang/test/SemaCXX/crash-auto-36064.cpp =================================================================== --- /dev/null +++ clang/test/SemaCXX/crash-auto-36064.cpp @@ -0,0 +1,8 @@ +// RUN: %clang_cc1 -fsyntax-only -std=c++11 %s -verify +template <typename A, decltype(new A)> // expected-error{{new expression for type 'auto' requires a constructor argument}} +struct b; +struct d { + static auto c = ; // expected-error{{expected expression}} + decltype(b<decltype(c), int>); // 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]}} +}; Index: clang/lib/AST/Type.cpp =================================================================== --- clang/lib/AST/Type.cpp +++ 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());
Index: clang/test/SemaCXX/crash-auto-36064.cpp =================================================================== --- /dev/null +++ clang/test/SemaCXX/crash-auto-36064.cpp @@ -0,0 +1,8 @@ +// RUN: %clang_cc1 -fsyntax-only -std=c++11 %s -verify +template <typename A, decltype(new A)> // expected-error{{new expression for type 'auto' requires a constructor argument}} +struct b; +struct d { + static auto c = ; // expected-error{{expected expression}} + decltype(b<decltype(c), int>); // 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]}} +}; Index: clang/lib/AST/Type.cpp =================================================================== --- clang/lib/AST/Type.cpp +++ 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());
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits