rsmith accepted this revision.
This revision is now accepted and ready to land.

================
Comment at: lib/Sema/SemaTemplateInstantiateDecl.cpp:2114
@@ -2113,1 +2113,3 @@
+    EnterExpressionEvaluationContext ConstantEvaluated(SemaRef,
+                                                       
Sema::ConstantEvaluated);
     ExprResult Value = SemaRef.SubstExpr(D->getDefaultArgument(), 
TemplateArgs);
----------------
faisalv wrote:
> Looks reasonable to me - since it is consistent with the other changes I had 
> made.  But somewhat orthogonal to your fix, I wouldn't mind Richard 
> commenting on why constant expression evaluation does not have 
> IsPotentiallyEvaluatedContext return false (and avoid adding an entry to 
> MaybeODRUse)
> Also, just as SubstituteDefaultTemplateArgument does, Perhaps we should add 
> an InstantiatingTemplate on the stack that marks this as a substitution into  
> default arguments.  It would be nice if we could refactor both into a call to 
> the same function (i.e SubstittueDefaultTempalteArgument) - but looking at 
> the code for it, that would be a little tricky.
> My 2 cents.
"Potentially evaluated" is a term defined in the standard; it would be 
confusing for us to use it to mean something else. Constant expressions *are* 
evaluated (typically only during compilation), and they can result in odr-use. 
The cases where they don't do so are somewhat specialized.

I don't think we need or want a separate entry on the instantiation stack, as 
we're still instantiating pieces of the same entity, with the same 
instantiation semantics.


http://reviews.llvm.org/D17576



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to