Thread overview
[Issue 9127] New: Error on getting `stringof` on field with body-less interface type
Dec 09, 2012
Denis Shelomovskij
Dec 11, 2012
Kenji Hara
Feb 04, 2013
Andrej Mitrovic
December 09, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=9127

           Summary: Error on getting `stringof` on field with body-less
                    interface type
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: verylonglogin.reg@gmail.com


--- Comment #0 from Denis Shelomovskij <verylonglogin.reg@gmail.com> 2012-12-09 11:40:27 MSK ---
---
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
---

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
December 11, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=9127



--- Comment #1 from Kenji Hara <k.hara.pg@gmail.com> 2012-12-11 05:35:13 PST ---
By git head, the code outputs:

----
test.d(1): Error: interface test.I is forward referenced when looking for
'stringof'
----

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
February 04, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9127


Andrej Mitrovic <andrej.mitrovich@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrej.mitrovich@gmail.com


--- Comment #2 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2013-02-04 10:55:47 PST ---
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.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------