[Issue 22472] New: Invalid error message for `void` return from non-`void` functions

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Nov 3 12:02:58 UTC 2021


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 at puremagic.com
          Reporter: moonlightsentinel at 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

--


More information about the Digitalmars-d-bugs mailing list