================
@@ -960,6 +960,8 @@ Parser::ParseNonTypeTemplateParameter(unsigned Depth, 
unsigned Position) {
       EnterExpressionEvaluationContext ConstantEvaluated(
           Actions, Sema::ExpressionEvaluationContext::ConstantEvaluated);
       DefaultArg = Actions.CorrectDelayedTyposInExpr(ParseInitializer());
+      if (DefaultArg.isUsable())
+        DefaultArg = Actions.ActOnConstantExpression(DefaultArg);
----------------
cor3ntin wrote:

I believe it is, yes (I agree it is deeply weird)

Per https://eel.is/c++draft/basic#def.odr-10, if x is odr-used, the program is 
ill-formed 
(x is a local variable, there is an intervening lambda scope and x is not 
captured)

So x can't be odr used. And per https://eel.is/c++draft/basic#def.odr-5 - it 
would be

I agree that this is weird. It might be worth asking CWG
However, i think the change is correct _regardless_ of further bugs with 
captures.

https://github.com/llvm/llvm-project/pull/107073
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to