ahatanak added a comment.

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.


https://reviews.llvm.org/D36915



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

Reply via email to