Bug 24224 – __traits(initSymbol) treats aggregate-derived enum as base type

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2023-11-03T09:40:31Z
Last change time
2023-11-03T13:17:45Z
Keywords
pull
Assigned to
No Owner
Creator
Paul Backus

Comments

Comment #0 by snarwin+bugzilla — 2023-11-03T09:40:31Z
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.
Comment #1 by dlang-bot — 2023-11-03T10:40:22Z
@pbackus created dlang/dmd pull request #15776 "Fix Issue 24224 - __traits(initSymbol) treats aggregate-derived enum …" fixing this issue: - Fix Issue 24224 - __traits(initSymbol) treats aggregate-derived enum as base type https://github.com/dlang/dmd/pull/15776
Comment #2 by dlang-bot — 2023-11-03T13:17:45Z
dlang/dmd pull request #15776 "Fix Issue 24224 - __traits(initSymbol) treats aggregate-derived enum …" was merged into master: - 01d8c635b3a3b41cd39936359915f0a164eb7cc8 by Paul Backus: Fix Issue 24224 - __traits(initSymbol) treats aggregate-derived enum as base type https://github.com/dlang/dmd/pull/15776