Null and IFTI

kenji hara k.hara.pg at gmail.com
Sun Dec 11 04:05:58 PST 2011


2.057 will compile this code, because it adds the new feature.
Now null literal has the type that is expressed as typeof(null), not void*.
And typeof(null) is derived from all class types.

static assert(is(typeof(null) : Bob));   // pass in 2.057

Then IFTI works with null literal correctly.

Kenji Hara

2011/12/11 Andrew Wiley <wiley.andrew.j at gmail.com>:
> ---
> class Bob {
> }
>
> void doSomething(T)(Bob bob, T data) {
> }
>
> void main() {
>        doSomething(null, 5); // Error: template test.doSomething(T) does not
> match any function template declaration
>        // Error: template test.doSomething(T) cannot deduce template
> function from argument types !()(void*,int)
> }
> ---
>
> Bug?


More information about the Digitalmars-d mailing list