https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119072

            Bug ID: 119072
           Summary: GCC rejects type declaration inside decltype specifier
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: tymi at tymi dot org
  Target Milestone: ---

Declaring a type inside decltype causes GCC to error out

https://redirect.compiler.gg/cBNsuyog

It doesn't even work for forward declarations. GCC accepts type aliases though.

Sample code:
```cpp
// Compile with -std=c++23 -pedantic-errors
std::vector<decltype(([]{ enum struct X : unsigned char {}; return X{}; })())>
v1{}; // rejects

std::vector<decltype(([]{ using X = int; return X{}; })())> v2{}; // accepts
```

Reply via email to