[Issue 20326] New: stringof on opaque type results in forward reference error

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Oct 26 22:00:49 UTC 2019


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

          Issue ID: 20326
           Summary: stringof on opaque type results in forward reference
                    error
           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

`T.stringof` causes a forward reference error if T is an opaque type
(class/interface/union/struct without definition):

-------------------------------------
test.d:

class C;
static assert(C.stringof == "C");
// test.d(1): Error: class test.C is forward referenced when looking for
stringof
// test.d(2):        while evaluating: static assert("C" == "C")

interface I;
static assert(I.stringof == "I");
test.d(4): Error: interface test.I is forward referenced when looking for
stringof
test.d(5):        while evaluating: static assert("I" == "I")

union U;
static assert(U.stringof == "U");
test.d(7): Error: union test.U is forward referenced when looking for stringof
test.d(8):        while evaluating: static assert("U" == "U")

struct S;
static assert(S.stringof == "C");
test.d(10): Error: struct test.S is forward referenced when looking for
stringof
test.d(11):        while evaluating: static assert("S" == "C")

--


More information about the Digitalmars-d-bugs mailing list