[Issue 21785] New: Cannot declare variable of opaque enum with base type

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Mar 30 23:57:45 UTC 2021


https://issues.dlang.org/show_bug.cgi?id=21785

          Issue ID: 21785
           Summary: Cannot declare variable of opaque enum with base type
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: moonlightsentinel at disroot.org

The following code doesn't compile unless `var` is void-initialized:

--------------------------------------
enum Xobj : void*;

void main()
{
    Xobj var;
}
--------------------------------------

Error: enum enum_init.Xobj forward reference of Xobj.init

There is no forward reference involved and `var` can just be initialized by
`void.init`.

--


More information about the Digitalmars-d-bugs mailing list