From owner-svn-src-projects@freebsd.org Tue Jan 19 18:57:38 2016 Return-Path: Delivered-To: svn-src-projects@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 871AEA892CB for ; Tue, 19 Jan 2016 18:57:38 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3E6BB119F; Tue, 19 Jan 2016 18:57:38 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u0JIvb65096611; Tue, 19 Jan 2016 18:57:37 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u0JIvbsr096610; Tue, 19 Jan 2016 18:57:37 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201601191857.u0JIvbsr096610@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Tue, 19 Jan 2016 18:57:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r294337 - projects/clang380-import/contrib/llvm/tools/clang/lib/Sema X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jan 2016 18:57:38 -0000 Author: dim Date: Tue Jan 19 18:57:37 2016 New Revision: 294337 URL: https://svnweb.freebsd.org/changeset/base/294337 Log: Pull in r258110 from upstream clang trunk, by Faisal Vali: Fix PR26134: When substituting into default template arguments, keep CurContext unchanged. Or, do not set Sema's CurContext to the template declaration's when substituting into default template arguments of said template declaration. If we do push the template declaration context on to Sema, and the template declaration is at namespace scope, Sema can get confused and try and do odr analysis when substituting into default template arguments, even though the substitution could be occurring within a dependent context. I'm not sure why this was being done, perhaps there was concern that if a default template argument referred to a previous template parameter, it might not be found during substitution - but all regression tests pass, and I can't craft a test that would cause it to fails (if some one does, please inform me, and i'll craft a different fix for the PR). This patch removes a single line of code, but unfortunately adds more than it removes, because of the tests. Some day I still hope to commit a patch that removes far more lines than it adds, while leaving clang better for it ;) Sorry that r253590 ("Change the expression evaluation context from Unevaluated to ConstantEvaluated while substituting into non-type template argument defaults") caused the PR! This fix will be merged to the upstream release_38 branch soon, but we need it now, to fix a failure in the databases/sfcgal port. Modified: projects/clang380-import/contrib/llvm/tools/clang/lib/Sema/SemaTemplate.cpp Modified: projects/clang380-import/contrib/llvm/tools/clang/lib/Sema/SemaTemplate.cpp ============================================================================== --- projects/clang380-import/contrib/llvm/tools/clang/lib/Sema/SemaTemplate.cpp Tue Jan 19 18:55:44 2016 (r294336) +++ projects/clang380-import/contrib/llvm/tools/clang/lib/Sema/SemaTemplate.cpp Tue Jan 19 18:57:37 2016 (r294337) @@ -3281,7 +3281,6 @@ SubstDefaultTemplateArgument(Sema &SemaR for (unsigned i = 0, e = Param->getDepth(); i != e; ++i) TemplateArgLists.addOuterTemplateArguments(None); - Sema::ContextRAII SavedContext(SemaRef, Template->getDeclContext()); EnterExpressionEvaluationContext ConstantEvaluated(SemaRef, Sema::ConstantEvaluated); return SemaRef.SubstExpr(Param->getDefaultArgument(), TemplateArgLists);