Enums, typedefs and lowest common denominators

Sean Kelly sean at f4.ca
Mon Nov 27 11:02:42 PST 2006


Stewart Gordon wrote:
> http://www.digitalmars.com/d/type.html
> "# If one operand is a typedef and the other is the base type of that 
> typedef, the result is the base type.
> # If the two operands are different typedefs but of the same base type, 
> then the result is that base type."
...
> This appears to be due to promotion rules that have been in place for a 
> while, but the problem with this code has only just manifested in the 
> light of the fix to bug 349.
> 
> http://d.puremagic.com/issues/show_bug.cgi?id=349

This appears related to the bug report I just submitted:

http://d.puremagic.com/issues/show_bug.cgi?id=580

> Anyway, back to the point.  It would appear that by "base type" the spec 
> means the built-in (or class or struct or union) type from which the 
> typedef is ultimately derived.
> 
> This spec doesn't mention anything about enums, but the compiler seems 
> to be treating enums and typedefs as a single entity in this respect.

I think this changed at some point.  The code in which I found the bug 
reported in 580 worked fine until a few months ago.  I made a temporary 
change to work around the problem and forgot to report it, and the 
behavior persists in 175.


Sean



More information about the Digitalmars-d mailing list