www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - is expression with template parameter list

reply Jacob Carlborg <doob me.com> writes:
The following example compiles work as expected:

import std.stdio;
import std.typecons;

void main()
{
     Nullable!(int) a;

     static if(is(typeof(a) == Nullable!(U), U))
         writeln("true");
     else
         writeln("false");
}

But if I use the fully qualified name in the condition, i.e. 
"std.typecons.Nullable!(U)", then I get this compile error:

main.d(8): Error: undefined identifier 'U'

Shouldn't this work? I have tried with the latest beta an a bunch of 
older versions of DMD.

-- 
/Jacob Carlborg
Jan 12 2016
parent Steven Schveighoffer <schveiguy yahoo.com> writes:
On 1/12/16 8:03 AM, Jacob Carlborg wrote:
 The following example compiles work as expected:

 import std.stdio;
 import std.typecons;

 void main()
 {
      Nullable!(int) a;

      static if(is(typeof(a) == Nullable!(U), U))
          writeln("true");
      else
          writeln("false");
 }

 But if I use the fully qualified name in the condition, i.e.
 "std.typecons.Nullable!(U)", then I get this compile error:

 main.d(8): Error: undefined identifier 'U'

 Shouldn't this work? I have tried with the latest beta an a bunch of
 older versions of DMD.
Looks like a bug to me. -Steve
Jan 12 2016