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

            Bug ID: 125440
           Summary: bad diagnostic for some invalid code with typename and
                    enum class
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pinskia at gcc dot gnu.org
  Target Milestone: ---

Take:
```
template <typename T> class C {
  enum class E { e };
  typename E::T foo() { return E::e; }
};
```

Currently GCC produces:
```
<source>:3:15: error: need 'typename' before 'C<T>::E::T' because 'C<T>::E' is
a dependent scope [-Wtemplate-body]
    3 |   typename E::T foo() { return E::e; }
      |               ^
      |               typename 
```

But there is already a typename in the front. The problem is rather E is not a
class but an `enum class`.

Reply via email to