digitalmars.D.bugs - [Issue 1142] New: .stringof performs semantic analysis
- d-bugmail puremagic.com (23/23) Apr 13 2007 http://d.puremagic.com/issues/show_bug.cgi?id=1142
- d-bugmail puremagic.com (26/26) Apr 14 2007 http://d.puremagic.com/issues/show_bug.cgi?id=1142
- d-bugmail puremagic.com (9/9) Apr 23 2007 http://d.puremagic.com/issues/show_bug.cgi?id=1142
http://d.puremagic.com/issues/show_bug.cgi?id=1142 Summary: .stringof performs semantic analysis Product: D Version: 1.012 Platform: PC OS/Version: Windows Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: bugzilla digitalmars.com ReportedBy: clugdbug yahoo.com.au According to the spec, "If applied to an expression, it is the source representation of that expression. Semantic analysis is not done for that expression." But it seems that semantic analysis always occurs. This does not compile: --- const char [] q = (1.2143*nonexistent).stringof; --- By contrast, is() expressions also don't do semantic analysis, and they work correctly: static assert(!is(typeof(1.2143*nonexistent))); --
Apr 13 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1142 deewiant gmail.com changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |rejects-valid, spec 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". --
Apr 14 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1142 thomas-dloop kuehne.cn changed: What |Removed |Added ---------------------------------------------------------------------------- OS/Version|Windows |All Added to DStress as http://dstress.kuehne.cn/compile/s/stringof_01_A.d --
Apr 23 2007