[Bug c++/91746] Bogus error due to a type and variable with the same name

pinskia at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Sep 11 22:45:00 GMT 2019


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

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Just for refernce of the C++ standard wording:
[basic.scope.class] paragraph 2:

"A name N used in a class S shall refer to the same declaration in its context
and when re-evaluated in the completed scope of S. No diagnostic is required
for a violation of this rule."

NOTE the "No dianostic is required" part.  So even though it is invalid to do
this, compilers don't need to check for volations.  If you want clang/MSVC to
detect the violation of this rule, please file a bug with them.


More information about the Gcc-bugs mailing list