[Bug c++/102165] New: poor error message for enum class scope and taking the address
pinskia at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Sep 1 20:29:25 GMT 2021
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102165
Bug ID: 102165
Summary: poor error message for enum class scope and taking the
address
Product: gcc
Version: 12.0
Status: UNCONFIRMED
Keywords: diagnostic
Severity: enhancement
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: pinskia at gcc dot gnu.org
Target Milestone: ---
Take:
enum class enu {a};
int t{&enu::a};
----- CUT ----
Currently we get:
<source>:3:13: error: 'enu' is not a class type
3 | int t{&enu::a};
| ^
Which is right but wrong at the same time.
This is what clang produces:
<source>:3:7: error: cannot take the address of an rvalue of type 'enu'
int t{&enu::a};
^~~~~~~
More information about the Gcc-bugs
mailing list