[Issue 24224] New: __traits(initSymbol) treats aggregate-derived enum as base type
    d-bugmail at puremagic.com 
    d-bugmail at puremagic.com
       
    Fri Nov  3 09:40:31 UTC 2023
    
    
  
https://issues.dlang.org/show_bug.cgi?id=24224
          Issue ID: 24224
           Summary: __traits(initSymbol) treats aggregate-derived enum as
                    base type
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: snarwin+bugzilla at gmail.com
As of DMD 2.105.3, the following program compiles and runs to completion:
---
struct S { int n; }
enum E : S { a = S(123) }
void main()
{
    assert(__traits(initSymbol, E) is __traits(initSymbol, S));
}
---
Since __traits(initSymbol) does not support enum types, this program should
fail to compile. __traits(initSymbol, E) certainly should not return the
initializer for a type other than E.
--
    
    
More information about the Digitalmars-d-bugs
mailing list