[Issue 4018] New: Line Number not set at instatiation point
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sat Mar 27 09:30:40 PDT 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4018
Summary: Line Number not set at instatiation point
Product: D
Version: 2.041
Platform: Other
URL: http://digitalmars.com/d/2.0/template.html#TemplateVal
ueParameter
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: Jesse.K.Phillips+D at gmail.com
CC: Jesse.K.Phillips+D at gmail.com
--- Comment #0 from Jesse Phillips <Jesse.K.Phillips+D at gmail.com> 2010-03-27 09:30:37 PDT ---
The specification states that:
The __FILE__ and __LINE__ expand to the source file name and line number at the
point of instantiation.
This is not the case for the code below:
-------------------
import std.stdio;
void ODSfd(alias n)() {
writefln("%s:%s | %s = %d", __FILE__, __LINE__, n.stringof, n);
}
void ODSfs(alias n)() {
writefln("%s:%s | %s = %s", __FILE__, __LINE__, n.stringof, n);
}
void ODSfx(alias n)() {
writefln("%s:%s | %s = 0x%08x", __FILE__, __LINE__, n.stringof, n);
}
void main() {
int zbar = 5;
string foo = "hi";
ODSfd!(zbar);
ODSfs!(foo);
ODSfx!(zbar);
}
-------------------
Expected output:
file.d:17 | zbar = 5
file.d:18 | foo = hi
file.d:19 | zbar = 0x00000005
Actual output:
file.d:4 | zbar = 5
file.d:7 | foo = hi
file.d:10 | zbar = 0x00000005
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list