Bug 9127 – Error on getting `stringof` on field with body-less interface type

Status
RESOLVED
Resolution
WORKSFORME
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-12-09T00:40:27Z
Last change time
2021-04-04T22:20:40Z
Keywords
rejects-valid
Assigned to
No Owner
Creator
Denis Shelomovskii

Comments

Comment #0 by verylonglogin.reg — 2012-12-09T00:40:27Z
--- interface I; struct S { I a; } enum e = S.tupleof[0].stringof; // line 3 --- Output: --- main.d(3): Error: function expected before (), not "module main"c of type string ---
Comment #1 by k.hara.pg — 2012-12-11T05:35:13Z
By git head, the code outputs: ---- test.d(1): Error: interface test.I is forward referenced when looking for 'stringof' ----
Comment #2 by andrej.mitrovich — 2013-02-04T10:55:47Z
This is true for any forward declaration: interface I; struct S; class C; enum ei = I.stringof; enum es = S.stringof; enum ec = C.stringof; test.d(3): Error: interface test.I is forward referenced when looking for 'stringof' test.d(7): Error: struct S is forward referenced test.d(5): Error: class test.C is forward referenced when looking for 'stringof' Note that Walter has stated before that .stringof is allowed to be overriden by the user, so this might have to be closed as invalid.
Comment #3 by moonlightsentinel — 2021-04-04T22:20:40Z
Works with current master