void main returning int - why compiles?

bearophile bearophileHUGS at lycos.com
Sat Jan 1 06:38:59 PST 2011


> 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);
> }

Simpler:

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

But maybe this bug report is already present.

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list