Thread overview |
---|
April 14, 2007 [Issue 1142] New: .stringof performs semantic analysis | ||||
---|---|---|---|---|
| ||||
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))); -- |
April 14, 2007 [Issue 1142] .stringof performs semantic analysis | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=1142 deewiant@gmail.com changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |rejects-valid, spec ------- Comment #1 from deewiant@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". -- |
April 23, 2007 [Issue 1142] .stringof performs semantic analysis | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=1142 thomas-dloop@kuehne.cn changed: What |Removed |Added ---------------------------------------------------------------------------- OS/Version|Windows |All ------- Comment #2 from thomas-dloop@kuehne.cn 2007-04-23 12:56 ------- Added to DStress as http://dstress.kuehne.cn/compile/s/stringof_01_A.d -- |
Copyright © 1999-2021 by the D Language Foundation