https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55776
Ian McInerney <ian.s.mcinerney at ieee dot org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |ian.s.mcinerney at ieee dot org --- Comment #9 from Ian McInerney <ian.s.mcinerney at ieee dot org> --- Based on all these examples, it seems like the potential for confusion/incorrect behavior is when the shadowed name is used on the right-hand side of an assignment inside the enum class declaration. So why does this need to trigger if it is just declaring the name and not using it in the enum class declatation? Can this warning instead only warn on a usage in the declaration? e.g. the original example in comment 1 never used foo in the enum class to initialize values in the enum, so where is the possibility for incorrect behavior in this case? Throwing a warning in this case leads to excess warnings in some cases when compiled with headers from MingW, since they tend to define things like RECT, INPUT, OUTPUT, etc. so the shadowing warnings are thrown if you use any of those names in an enum class.