www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 22472] New: Invalid error message for `void` return from

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

          Issue ID: 22472
           Summary: Invalid error message for `void` return from
                    non-`void` functions
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: regression
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: moonlightsentinel disroot.org

======================================================
void doStuff();

int foo()
{
        return doStuff();   
}
======================================================
Error: `return` expression expected

The error message indicates that there was no expression, despite there being a
`void` one.

The previous message was more useful but changed after 2.066.0:

Error: cannot implicitly convert expression (doStuff()) of type void to int

--
Nov 03 2021