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

--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Jonathan Wakely from comment #4)
> For this code:
> 
> enum class foo : bar { baz };
> auto x = foo::baz;
> 
> We give:
> 
> e.C:1:6: warning: elaborated-type-specifier for a scoped enum must not use
> the ‘class’ keyword
>     1 | enum class foo : bar { baz };
>       | ~~~~ ^~~~~
>       |      -----
[...]
> The warning is just nonsense.

I'm now convinced that this warning does more harm than good. It's supposed to
be a pedwarn for this case:

enum D { };
extern enum class D d;

But that's just ill-formed, we should reject it outright, as Clang and EDG do.

And for the later errors, we should not assume the user is trying to write
foo::bar when **that's not going to be valid anyway**! We should assume they're
trying to write exactly what they wrote, with a base-type of bar, and diagnose
that 'bar' is not declared.

Reply via email to