[cfe-dev] Type of enum constants

Doug Gregor doug.gregor at gmail.com
Sun Oct 26 07:01:39 PDT 2008


On Sun, Oct 26, 2008 at 7:31 AM, Sebastian Redl
<sebastian.redl at getdesigned.at> wrote:
> 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



More information about the cfe-dev mailing list