This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/60994] gcc does not recognize hidden/shadowed enumeration as valid nested-name-specifier
- From: "momchil.velikov at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 29 Apr 2014 07:21:07 +0000
- Subject: [Bug c++/60994] gcc does not recognize hidden/shadowed enumeration as valid nested-name-specifier
- Auto-submitted: auto-generated
- References: <bug-60994-4 at http dot gcc dot gnu dot org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60994
--- Comment #3 from Momchil Velikov <momchil.velikov at gmail dot com> ---
(In reply to Markus Trippelsdorf from comment #1)
> Implicit enum to int conversion is not provided for a scoped enumeration.
This is not the reported error.
In fact, the correct output of the compiler would be to report the invalid
implicit conversion. It does not.
With explicit conversion to int, the compiler still gives an error, but the
error message is not helpful and obscures the cause of the problem, i.e.,
compiling this:
enum struct A
{
n = 3
};
int
foo()
{
int A;
return int(A::n);
}
results in:
b.cc: In function 'int foo()':
b.cc:10:10: error: expected primary-expression before 'int'
return int(A::n);
^
b.cc:10:10: error: expected ';' before 'int'
b.cc:10:10: error: expected primary-expression before 'int'