www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - null and IFTI

reply Max Samukha <samukha voliacable.com.removethis> writes:
It is unclear from the specs if null should be exact matched against
nullable types during IFTI. Now it works only for void*.

class C
{
}

void foo(T)(T x, C c) // C - a nullable type
{
}

void main()
{
    foo(1, null); // fails
    foo(1, cast(C)null); // ok
}

Is it by design?
Oct 03 2008
parent reply "Denis Koroskin" <2korden gmail.com> writes:
On Sat, 04 Oct 2008 10:50:33 +0400, Max Samukha  
<samukha voliacable.com.removethis> wrote:

 It is unclear from the specs if null should be exact matched against
 nullable types during IFTI. Now it works only for void*.

 class C
 {
 }

 void foo(T)(T x, C c) // C - a nullable type
 {
 }

 void main()
 {
     foo(1, null); // fails
     foo(1, cast(C)null); // ok
 }

 Is it by design?
I think it is a bug. This might be relevant: http://d.puremagic.com/issues/show_bug.cgi?id=2389
Oct 04 2008
parent Max Samukha <samukha voliacable.com.removethis> writes:
On Sat, 04 Oct 2008 12:01:24 +0400, "Denis Koroskin"
<2korden gmail.com> wrote:

On Sat, 04 Oct 2008 10:50:33 +0400, Max Samukha  
<samukha voliacable.com.removethis> wrote:

 It is unclear from the specs if null should be exact matched against
 nullable types during IFTI. Now it works only for void*.

 class C
 {
 }

 void foo(T)(T x, C c) // C - a nullable type
 {
 }

 void main()
 {
     foo(1, null); // fails
     foo(1, cast(C)null); // ok
 }

 Is it by design?
I think it is a bug. This might be relevant: http://d.puremagic.com/issues/show_bug.cgi?id=2389
Not a big issue, but I felt like filing it anyway http://d.puremagic.com/issues/show_bug.cgi?id=2394
Oct 05 2008