[Issue 2221] New: Bug with typeof(*this) in template struct
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sat Jul 12 05:29:02 PDT 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2221
Summary: Bug with typeof(*this) in template struct
Product: D
Version: 1.032
Platform: PC
OS/Version: Windows
Status: NEW
Keywords: rejects-valid
Severity: normal
Priority: P2
Component: DMD
AssignedTo: bugzilla at digitalmars.com
ReportedBy: wbaxter at gmail.com
Here's the code:
-----
struct Struct(T)
{
static if (is(typeof(T.nan))) {
static const is_fptype = true;
}
else {
static const is_fptype = false;
}
static if(typeof(*this).is_fptype)
//static if((typeof(*this)).is_fptype) //<- fixes it
{
pragma(msg, "T is " ~ T.stringof);
pragma(msg, typeof(*this).stringof ~ " is fp type");
}
else {
pragma(msg, "T is " ~ T.stringof);
pragma(msg, typeof(*this).stringof ~ " is NOT fp type");
}
}
alias Struct!(float) Sf;
alias Struct!(int) Si;
-------
More information about the Digitalmars-d-bugs
mailing list