Date: Sat, 21 Aug 2021 21:04:09 GMT From: Dimitry Andric <dim@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: efa485d5c390 - main - Apply clang fix for assertion failure compiling multimedia/minitube Message-ID: <202108212104.17LL49cQ063482@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=efa485d5c390b745f53761da9159721243c48b7b commit efa485d5c390b745f53761da9159721243c48b7b Author: Dimitry Andric <dim@FreeBSD.org> AuthorDate: 2021-08-21 21:03:37 +0000 Commit: Dimitry Andric <dim@FreeBSD.org> CommitDate: 2021-08-21 21:03:50 +0000 Apply clang fix for assertion failure compiling multimedia/minitube Merge commit 79f9cfbc21e0 from llvm git (by Yaxun (Sam) Liu): Do not merge LocalInstantiationScope for template specialization A lambda in a function template may be recursively instantiated. The recursive lambda will cause a lambda function instantiated multiple times, one inside another. The inner LocalInstantiationScope should not be marked as MergeWithParentScope since it already has references to locals properly substituted, otherwise it causes assertion due to the check for duplicate locals in merged LocalInstantiationScope. Reviewed by: Richard Smith Differential Revision: https://reviews.llvm.org/D98068 Reported by: yuri PR: 257978 MFC after: 3 days --- .../llvm-project/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/contrib/llvm-project/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp b/contrib/llvm-project/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp index dc1e0ef60cac..216a64e02380 100644 --- a/contrib/llvm-project/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp +++ b/contrib/llvm-project/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp @@ -4841,10 +4841,13 @@ void Sema::InstantiateFunctionDefinition(SourceLocation PointOfInstantiation, // Introduce a new scope where local variable instantiations will be // recorded, unless we're actually a member function within a local // class, in which case we need to merge our results with the parent - // scope (of the enclosing function). + // scope (of the enclosing function). The exception is instantiating + // a function template specialization, since the template to be + // instantiated already has references to locals properly substituted. bool MergeWithParentScope = false; if (CXXRecordDecl *Rec = dyn_cast<CXXRecordDecl>(Function->getDeclContext())) - MergeWithParentScope = Rec->isLocalClass(); + MergeWithParentScope = + Rec->isLocalClass() && !Function->isFunctionTemplateSpecialization(); LocalInstantiationScope Scope(*this, MergeWithParentScope);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202108212104.17LL49cQ063482>