eandrews added a comment.

I came across a strange error when capturing arguments in a lambda inside 
another lambda. I filed an issue here - 
https://github.com/llvm/llvm-project/issues/59549

Short reproducer:

  void foo () {
    constexpr int i = 2;
  
    [&]() {
      [=]() [[clang::annotate_type("test", i)]]{};
    };
  }
  
  <source>:5:42: error: variable 'i' cannot be implicitly captured in a lambda 
with no capture-default specified
      [=]() [[clang::annotate_type("test", i)]]{};
                                           ^
  <source>:2:17: note: 'i' declared here
    constexpr int i = 2;

I noticed the error is not thrown if 'i' is captured in lambda body instead. 
IIUC all changes pertaining to P2036R3 has been reverted from clang right? So 
this bug is an existing issue in Clang with how attributes on lambdas are 
handled? Will this case be fixed in this PR?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D124351/new/

https://reviews.llvm.org/D124351

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

Reply via email to