[Issue 13293] New: `typeof(<function returning T>)` gets printed as `T()`

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Thu Aug 14 04:26:07 PDT 2014


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

          Issue ID: 13293
           Summary: `typeof(<function returning T>)` gets printed as `T()`
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: minor
          Priority: P1
         Component: DMD
          Assignee: nobody at puremagic.com
          Reporter: schuetzm at gmx.net

>From http://forum.dlang.org/post/vtkrrkxgkzcfktyymitm@forum.dlang.org:

    struct Result {
        public @property auto save1() {
            return this;
        }
        public auto save2() {
            return this;
        }
    }

    pragma(msg, typeof(Result.init.save1));
    pragma(msg, typeof(Result.init.save2));

This outputs:

    Result
    Result()

I guess the second type is supposed to represent the function? It should print
something that makes this clear, `Result()` doesn't make sense.

--


More information about the Digitalmars-d-bugs mailing list