Thread overview |
---|
February 15, 2007 [Issue 966] New: is(H==function) fails if H is a function type | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=966 Summary: is(H==function) fails if H is a function type Product: D Version: 1.005 Platform: PC OS/Version: Linux Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: bugzilla@digitalmars.com ReportedBy: elmar@zandere.de The following code fails with an assertion: bool isfun(H)( H h){ static if (is( H == function )) return true; else return false; } void fun( int i ) {} void main() { assert( isfun( &fun ) ); // should not } BTW: If H is a delegate type, then is(H==delegate) works fine in the corresponding code. -- |
March 29, 2007 [Issue 966] is(H==function) fails if H is a function type | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=966 ------- Comment #1 from thomas-dloop@kuehne.cn 2007-03-29 14:31 ------- Added to DStress as http://dstress.kuehne.cn/compile/i/is_17_A.d http://dstress.kuehne.cn/compile/i/is_17_B.d -- |
August 13, 2007 [Issue 966] is(H==function) fails if H is a function type | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=966 bugzilla@digitalmars.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |INVALID ------- Comment #2 from bugzilla@digitalmars.com 2007-08-12 22:10 ------- That's because &fun is not a function type, it's a pointer to a function. Rewrite the template as: bool isfun(H)( H h){ static if (is( H F == F*) && is(F == function )) return true; else return false; } and it will work. -- |
Copyright © 1999-2021 by the D Language Foundation