www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 19744] New: Confusing error message when annotating a

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

          Issue ID: 19744
           Summary: Confusing error message when annotating a non-member
                    function with `return`
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: monkeyworks12 hotmail.com

 safe
int* test(return scope int* n) return
{
    return n;
}

This prints a mildly nonsensical error message:

Error: function `test` static member has no this to which return can apply

Specifically, it is the "function `test` static member` part which is
confusing.

--
Mar 16 2019