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

            Bug ID: 122634
           Summary: error: keyword 'typename' not allowed outside of
                    templates (reflection)
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: eczbek.void at gmail dot com
  Target Milestone: ---

https://godbolt.org/z/7j9ne5f4a
Clang accepts this

```
struct A {};

struct B : typename[: ^^A :] {};

int main() {}
```

```
<source>:3:12: error: keyword 'typename' not allowed outside of templates
    3 | struct B : typename[: ^^A :] {};
      |            ^~~~~~~~
<source>:3:20: error: expected class-name before '[:' token
    3 | struct B : typename[: ^^A :] {};
      |                    ^~
<source>:3:20: error: expected '{' before '[:' token
<source>:3:20: error: expected unqualified-id before '[:' token
ASM generation compiler returned: 1
<source>:3:12: error: keyword 'typename' not allowed outside of templates
    3 | struct B : typename[: ^^A :] {};
      |            ^~~~~~~~
<source>:3:20: error: expected class-name before '[:' token
    3 | struct B : typename[: ^^A :] {};
      |                    ^~
<source>:3:20: error: expected '{' before '[:' token
<source>:3:20: error: expected unqualified-id before '[:' token
Execution build compiler returned: 1
Build failed
```

Reply via email to