[PATCH] D17576: Fix assertion failure on MaybeODRUseExprs.

Faisal Vali via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 24 12:14:55 PST 2016

faisalv added inline comments.

Comment at: lib/Sema/SemaTemplateInstantiateDecl.cpp:2114
@@ -2113,1 +2113,3 @@
+    EnterExpressionEvaluationContext ConstantEvaluated(SemaRef,
+                                                       Sema::ConstantEvaluated);
     ExprResult Value = SemaRef.SubstExpr(D->getDefaultArgument(), TemplateArgs);
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.


More information about the cfe-commits mailing list