Bug 20326 – stringof on opaque type results in forward reference error

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2019-10-26T22:00:49Z
Last change time
2019-10-28T09:43:32Z
Keywords
pull
Assigned to
No Owner
Creator
moonlightsentinel

Comments

Comment #0 by moonlightsentinel — 2019-10-26T22:00:49Z
`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")
Comment #1 by dlang-bot — 2019-10-27T02:09:30Z
@MoonlightSentinel created dlang/dmd pull request #10511 "Fix Issue 20326 - stringof on opaque type results in forward referenc…" fixing this issue: - Fix Issue 20326 - stringof on opaque type results in forward reference error https://github.com/dlang/dmd/pull/10511
Comment #2 by dlang-bot — 2019-10-28T09:43:32Z
dlang/dmd pull request #10511 "Fix Issue 20326 - stringof on opaque type results in forward referenc…" was merged into master: - c31a0a9b9a29858cffbf6a5b2e8c8471283d01ff by MoonlightSentinel: Fix Issue 20326 - stringof on opaque type results in forward reference error https://github.com/dlang/dmd/pull/10511