faisalv added a comment. In https://reviews.llvm.org/D36915#854317, @ahatanak wrote:
> In https://reviews.llvm.org/D36915#849622, @faisalv wrote: > > > I don't think this approach is entirely correct for at least the following > > reasons: > > > > 1. in the lambda case the machinery that diagnoses capture failures should > > be the machinery erroring on the lambda (when the parameter is odr-used) > > > Does this mean that it is OK to have a parameter or local variable appear in > a potentially-evaluated expression as long as it is not odr-used? I think > this is slightly different from the standard, which says a parameter or local > variable cannot appear as a potentially-evaluated expression in a default > argument. > > For example: > > void foo2(int); > > void func() { > const int a = 1; > void foo1(S s = [](){ foo2(a); }); // "a" is not in an unevaluated > context and is not odr-used. > } > > > > I think I need clarification as it will affect how or where we detect this > error. 'a' is not captured (and does not need to be captured) above, so I think that code should be ok. But I also think the following code should be ok at local scope within func. void foo(int = a); I thought there was a DR against the standard-draft with the intent of making these valid (if they are not already so)? https://reviews.llvm.org/D36915 _______________________________________________ cfe-commits mailing list [email protected] http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
