Author: serge-sans-paille Date: 2021-07-16T14:35:55+02:00 New Revision: 8ada884cbc2f02863cd71bddd97c7ff206ad3256
URL: https://github.com/llvm/llvm-project/commit/8ada884cbc2f02863cd71bddd97c7ff206ad3256 DIFF: https://github.com/llvm/llvm-project/commit/8ada884cbc2f02863cd71bddd97c7ff206ad3256.diff LOG: SubstTemplateTypeParmType can contain an 'auto' type in their replacement type This fixes bug 36064 Differential Revision: https://reviews.llvm.org/D106093 Added: clang/test/SemaCXX/crash-auto-36064.cpp Modified: clang/lib/AST/Type.cpp Removed: ################################################################################ diff --git a/clang/lib/AST/Type.cpp b/clang/lib/AST/Type.cpp index d3d0003e5adb..4a2fc5219ef0 100644 --- a/clang/lib/AST/Type.cpp +++ b/clang/lib/AST/Type.cpp @@ -1801,6 +1801,9 @@ namespace { } // 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 index 000000000000..5678cd8b730b --- /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 <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]}} +}; _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits