Issue 63880
Summary Unary `*` or `&` applied to immediately invoked lambda passed to constructor cast parsed as decomposition group
Labels
Assignees
Reporter ecatmur
    Since 11.0.0,
```c++
int main() { int(*[] { return new int; }()); }
```
```
<source>:2:20: warning: ISO C++17 does not allow a decomposition group to be empty [-Wempty-decomposition]
int main() { int(*[] { return new int; }()); }
                   ^
<source>:2:22: error: expected ')'
int main() { int(*[] { return new int; }()); }
 ^
<source>:2:17: note: to match this '('
int main() { int(*[] { return new int; }()); }
                ^
<source>:2:19: warning: decomposition declarations are a C++17 extension [-Wc++17-extensions]
int main() { int(*[] { return new int; }()); }
 ^~
<source>:2:19: error: decomposition declaration cannot be declared with type 'int (*)'; declared type must be 'auto' or reference to 'auto'
<source>:2:19: error: decomposition declaration '[]' requires an initializer
```

And, similarly,

```c++
struct S { S(...); void f(); };
int main() { S(&[]() -> int& { return *new int; }()).f(); }
```

```
<source>:2:20: error: expected unqualified-id
int main() { S(&[]() -> int& { return *new int; }()).f(); }
 ^
<source>:2:22: error: expected ')'
int main() { S(&[]() -> int& { return *new int; }()).f(); }
                     ^
<source>:2:15: note: to match this '('
int main() { S(&[]() -> int& { return *new int; }()).f(); }
              ^
```

Possibly related to https://github.com/llvm/llvm-project/issues/35570 ?
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to