www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 20326] New: stringof on opaque type results in forward

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 puremagic.com
          Reporter: moonlightsentinel 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")

--
Oct 26 2019