[Issue 19328] New: isExpression does not allow to check conversion to delegate/function

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Oct 23 15:00:35 UTC 2018


https://issues.dlang.org/show_bug.cgi?id=19328

          Issue ID: 19328
           Summary: isExpression does not allow to check conversion to
                    delegate/function
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dlang.org
          Assignee: nobody at puremagic.com
          Reporter: razvan.nitu1305 at gmail.com

The grammar allows to check if a type is convertible to a delegate through
isExpression [1]. However, compiling this:

template ParameterTupleOf( Fn )
{
      static if( is( Fn Params == function ) )
          pragma(msg, "function");
      else static if( is( Fn Params == delegate ) )
          pragma(msg, "delegate");
      else static if( is( Fn Params == Params* ) )
          pragma(msg, "pointer");
      else
          static assert( false, "Argument has no parameters." );
}

Issues a parsing error.

[1] https://dlang.org/spec/grammar.html#IsExpression

--


More information about the Digitalmars-d-bugs mailing list