[PATCH] D119609: [Clang][Sema] Don't act on ReturnStmt when parsing the lambda declarator.

Erich Keane via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 8 06:01:33 PST 2022


erichkeane added inline comments.


================
Comment at: clang/test/Sema/err-expr-stmt-in-default-arg.cpp:19
+  return bar(l);
+}
----------------
junaire wrote:
> erichkeane wrote:
> > For completeness, I'd like to see an in-function-defined-struct-member-function test here as well.
> > 
> > As for the above question about the recovery, something like:
> > 
> > `void fn(int i, int j = ({ {},{},{,} }), int k = "");` I think checks all the issues I can think of.  We want to make sure that 'k' still diagnoses its error correctly (and that we have just skipped all of the expression statement stuff).
> Note that clang is already rejected the code: https://godbolt.org/z/57c4qaaPo
> 
I more mean an example like this one:
https://godbolt.org/z/nf7W1zznh

I see that we already reject it, however you are doing a 'skip until' here, and I want to make sure that the error on 'k' diagnoses correctly still. 

With your change, I would expect the 1st two errors there to go away and be replaced by your new error.  BUT the 'k' type would still be there.

The point of this is to make sure that your error doesn't leave the parser in a 'bad' state.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119609



More information about the cfe-commits mailing list