cor3ntin added a comment.

> Presumably we should be parsing the attribute in the enclosing context rather 
> than in the half-way-inside-the-lambda context in which we parse parameters?

That's a good question.

  void f() {
  int y;
  (void)[=, x = 1]() 
      __attribute__((diagnose_if(!is_same<decltype((y)), int&>, "wrong type", 
"warning")))  // do we want this to work?
      __attribute__((diagnose_if(x != 1, "wrong type", "warning"))) // do we 
want this to work?
      mutable {}();
  }

I think we *probably* want both of this to compile and evaluate the conditions 
consistently with the new rule for trailing return type/`requires`/`noexcept` 
specifier (in that case triggering no warning).
So the consistent approach would be to parse them in the context of the call 
operator, once the captures and their type is known.

Is there any reason we should not be consistent with the spirit of the c++ spec 
here?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119136

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

Reply via email to