[Issue 1142] .stringof performs semantic analysis

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Apr 14 07:41:55 PDT 2007


http://d.puremagic.com/issues/show_bug.cgi?id=1142


deewiant at gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |rejects-valid, spec




------- Comment #1 from deewiant at gmail.com  2007-04-14 09:41 -------
The spec's .stringof example doesn't even compile:

import std.stdio;

struct Foo { }

enum Enum { RED }

typedef int myint;

void main()
{
    writefln((1+2).stringof);       // "1 + 2"
    writefln(Foo.stringof);         // "Foo"
    writefln(test.Foo.stringof);    // "test.Foo"
    writefln(int.stringof);         // "int"
    writefln((int*[5][]).stringof); // "int*[5][]"
    writefln(Enum.RED.stringof);    // "Enum.RED"
    writefln(test.myint.stringof);  // "test.myint"
    writefln((5).stringof);         // "5"
}

test.Foo.stringof and test.myint.stringof refuse to compile. Adding "module
test;" makes them compile, but then the results are not "test.Foo" and
"test.myint", but only "Foo" and "myint".


-- 



More information about the Digitalmars-d-bugs mailing list