Undescriptive linker error. (bug?)

Sjoerd Nijboer dlang at sjoerdnijboer.com
Fri Apr 5 21:59:35 UTC 2019


module mymodule;

class Foo{}

Foo Bar()
{
	Foo foo();
	
	return foo;
}

int main()
{
	auto foo = Bar();

     return 0;
}

This code doesn't compile with a linker error that there's a 
missing symbol for `Foo Bar()` on windows.
After all, `Foo foo();` isn't legitimate D.
But why does it return a linker error?
shouldn't it give an error that is more descriptive about a class 
instance being wrong?
I feel like this would be a common thing people try to write.
Especially in templates this would become difficult to narrow 
down.


More information about the Digitalmars-d-learn mailing list