[Bug c++/64758] [C++11] Give better error message when name of enum's base type cannot be resolved

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon May 23 08:46:00 GMT 2022


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

--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Jonathan Wakely from comment #4)
> I suggest that we should notice that ": bar" is bad, give an error about
> "bar" being undeclared, and then act as though no enum-base was present for
> the rest of the compilation. All the other diagnostics should vanish at that
> point.

That seems to be what Clang does:

e.C:1:18: error: unknown type name 'bar'
enum class foo : bar { baz };
                 ^
1 error generated.

There's no error about foo::baz, presumably because after realising the
enum-base was bad, they just skipped it and still compiled the enumerator-list
successfully.

EDG gives pretty much the same errors as GCC though.


More information about the Gcc-bugs mailing list