summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
diff options
context:
space:
mode:
authorFaisal Vali <faisalv@yahoo.com>2016-01-19 03:58:55 +0000
committerFaisal Vali <faisalv@yahoo.com>2016-01-19 03:58:55 +0000
commitcc496a99775e6bc637af22b63d3f743e2140d1cb (patch)
tree006026a458d2ded7c2f43e5cb5368646584791ab /clang/lib/Sema
parent31955002975b5ae9e4130d0fbeb954bbeb0f95f0 (diff)
downloadbcm5719-llvm-cc496a99775e6bc637af22b63d3f743e2140d1cb.tar.gz
bcm5719-llvm-cc496a99775e6bc637af22b63d3f743e2140d1cb.zip
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! llvm-svn: 258110
Diffstat (limited to 'clang/lib/Sema')
-rw-r--r--clang/lib/Sema/SemaTemplate.cpp1
1 files changed, 0 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp
index 2f3309b0593..878243932c8 100644
--- a/clang/lib/Sema/SemaTemplate.cpp
+++ b/clang/lib/Sema/SemaTemplate.cpp
@@ -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);
OpenPOWER on IntegriCloud