void main returning int - why compiles?

bearophile bearophileHUGS at lycos.com
Sat Jan 1 02:07:47 PST 2011

Daren Scot Wilson:

> I'm wondering why the following compiles.

It's yet another small compiler bug, fit for Bugzilla.

If you want I may add a bug report to Bugzilla that shows this as "accepts-invalid":

int foo(int x) {
    return x;
void main() {
    return foo(1);


More information about the Digitalmars-d-learn mailing list