This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/60994] gcc does not recognize hidden/shadowed enumeration as valid nested-name-specifier


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'


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]