Type of enum constants

Hi,

The type of an enum constant expression is currently the underlying type of the enum (usually int). While this is correct in C, it's incorrect in C++ and breaks overload resolution.

However, the code for defining enums is complex, with all those adjustments of the value, and I'm not sure which parts are necessary for correct functioning. Can someone who knows this code please adjust it so that in C++, EnumConstantDecl::getType() returns the enum type?

Sebastian

The type of an enum constant expression is currently the underlying type
of the enum (usually int). While this is correct in C, it's incorrect in
C++ and breaks overload resolution.

Oops. That's a bug. I've recorded it here:

  http://llvm.org/bugs/show_bug.cgi?id=2954

However, the code for defining enums is complex, with all those
adjustments of the value, and I'm not sure which parts are necessary for
correct functioning. Can someone who knows this code please adjust it so
that in C++, EnumConstantDecl::getType() returns the enum type?

I can handle this. I've dealt with the rules of C++ enums quite
recently, so it should be easier for me than most.

  - Doug