mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-25 11:37:56 +00:00
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.
This commit is contained in:
parent
47d45e347a
commit
5e23bfeb2d
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/projects/clang380-import/; revision=294337
@ -3281,7 +3281,6 @@ SubstDefaultTemplateArgument(Sema &SemaRef,
|
||||
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);
|
||||
|
Loading…
Reference in New Issue
Block a user