futogergely updated this revision to Diff 349480. futogergely added a comment.
formatting in instantiate-local-class.cpp CHANGES SINCE LAST ACTION https://reviews.llvm.org/D103595/new/ https://reviews.llvm.org/D103595 Files: clang/lib/Sema/SemaExpr.cpp clang/test/SemaTemplate/instantiate-local-class.cpp Index: clang/test/SemaTemplate/instantiate-local-class.cpp =================================================================== --- clang/test/SemaTemplate/instantiate-local-class.cpp +++ clang/test/SemaTemplate/instantiate-local-class.cpp @@ -504,3 +504,24 @@ } template void f<int>(); } + +namespace PR48839 { + template <typename T> + void construct() { + T(0); + } + + template <typename T> + void tester() { + struct d { + void test() { + construct<d>(); + } + constexpr d(T b) : a(b) {} + + T a; + }; + } + + void g() { tester<int>(); } +} Index: clang/lib/Sema/SemaExpr.cpp =================================================================== --- clang/lib/Sema/SemaExpr.cpp +++ clang/lib/Sema/SemaExpr.cpp @@ -17057,10 +17057,12 @@ PointOfInstantiation = Loc; } + const bool isLocalClass = + isa<CXXRecordDecl>(Func->getDeclContext()) && + cast<CXXRecordDecl>(Func->getDeclContext())->isLocalClass(); if (FirstInstantiation || TSK != TSK_ImplicitInstantiation || - Func->isConstexpr()) { - if (isa<CXXRecordDecl>(Func->getDeclContext()) && - cast<CXXRecordDecl>(Func->getDeclContext())->isLocalClass() && + (!isLocalClass && Func->isConstexpr())) { + if (isLocalClass && CodeSynthesisContexts.size()) PendingLocalImplicitInstantiations.push_back( std::make_pair(Func, PointOfInstantiation));
Index: clang/test/SemaTemplate/instantiate-local-class.cpp =================================================================== --- clang/test/SemaTemplate/instantiate-local-class.cpp +++ clang/test/SemaTemplate/instantiate-local-class.cpp @@ -504,3 +504,24 @@ } template void f<int>(); } + +namespace PR48839 { + template <typename T> + void construct() { + T(0); + } + + template <typename T> + void tester() { + struct d { + void test() { + construct<d>(); + } + constexpr d(T b) : a(b) {} + + T a; + }; + } + + void g() { tester<int>(); } +} Index: clang/lib/Sema/SemaExpr.cpp =================================================================== --- clang/lib/Sema/SemaExpr.cpp +++ clang/lib/Sema/SemaExpr.cpp @@ -17057,10 +17057,12 @@ PointOfInstantiation = Loc; } + const bool isLocalClass = + isa<CXXRecordDecl>(Func->getDeclContext()) && + cast<CXXRecordDecl>(Func->getDeclContext())->isLocalClass(); if (FirstInstantiation || TSK != TSK_ImplicitInstantiation || - Func->isConstexpr()) { - if (isa<CXXRecordDecl>(Func->getDeclContext()) && - cast<CXXRecordDecl>(Func->getDeclContext())->isLocalClass() && + (!isLocalClass && Func->isConstexpr())) { + if (isLocalClass && CodeSynthesisContexts.size()) PendingLocalImplicitInstantiations.push_back( std::make_pair(Func, PointOfInstantiation));
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits