[PATCH] D17576: Fix assertion failure on MaybeODRUseExprs.
Richard Smith via cfe-commits
cfe-commits at lists.llvm.org
Wed Feb 24 14:01:01 PST 2016
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
More information about the cfe-commits
mailing list