www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 15743] New: typeof function literal with unnamed parameter of

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

          Issue ID: 15743
           Summary: typeof function literal with unnamed parameter of
                    aliased type is void
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: ryan rcorre.net

alias T = int;
pragma(msg, typeof((string){}).stringof);   // void
pragma(msg, typeof((string s){}).stringof); // void function(string)
pragma(msg, typeof((int){}).stringof);      // void function(int)
pragma(msg, typeof((T){}).stringof);        // void

I would expect the first pragma to print void function(string), and the last to
print void function(int).

It appears the issue is with a parameter that has no name _and_ is declared as
an aliased type (e.g. if you use immutable(char)* instead of string it works as
expected).

--
Mar 02 2016