[Issue 2369] New: is(T == function) does not recognize function pointers
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Sep 21 17:49:45 PDT 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2369
Summary: is(T == function) does not recognize function pointers
Product: D
Version: 2.019
Platform: PC
OS/Version: Windows
Status: NEW
Keywords: wrong-code
Severity: normal
Priority: P2
Component: DMD
AssignedTo: bugzilla at digitalmars.com
ReportedBy: snake.scaly at gmail.com
Consider the example:
template IsFun(T) {
static if (is(T == function)) {
enum IsFun = T.stringof ~ ": fun";
} else {
enum IsFun = T.stringof ~ ": not fun";
}
}
void foo() {}
pragma(msg, IsFun!(typeof(foo))); // (void())(): fun
pragma(msg, IsFun!(typeof(&foo))); // void function(): not fun
I expect both forms to be detected as functions.
--
More information about the Digitalmars-d-bugs
mailing list