https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123878
Bug ID: 123878
Summary: GCC rejects valid program involving lambda evaluation
inside decltype with deleted parameterized ctor
Product: gcc
Version: 15.1.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: jlame646 at gmail dot com
Target Milestone: ---
The following valid program is rejected by gcc and clang but accepted by msvc.
Demo: https://godbolt.org/z/KnzqaM1Ev
```
struct C
{
C(int) = delete;
C(){};
};
decltype([b = C(3)](){ return 4;}()) var; //msvc OK but gcc and clang rejects
decltype([C(3)](){ return 4;}()) var2; //accepted by all compilers
int main()
{
}
```
This is well-formed as explained in the following stackoverflow thread:
https://stackoverflow.com/q/79878786/12002570