[Issue 2810] Forward reference to an auto function

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Sep 29 04:16:13 PDT 2009


http://d.puremagic.com/issues/show_bug.cgi?id=2810



--- Comment #5 from Sobirari Muhomori <maxmo at pochta.ru> 2009-09-29 04:16:12 PDT ---
A completely separate bug is actually what you described :) Auto functions are
obviously supported, I'm not sure if it's still valid to treat the auto keyword
as a storage class, if I'm not mistaken long ago it was meant to behave
differently.

The forward reference bugs are deeper than you think. The term "forward
reference" was taken from C world, the fact is compiler does things in an
order, and when at a certain step you need a result of a subsequent step, you
get into trouble. In C this situation happened for forward references in
lexical sense, because C compiler does things in lexical order. While D
compiler can first parse function signatures and then - function bodies, this
trick doesn't work for auto functions because their signatures can't be
resolved without compilation of the body, so their return types can be
accessible only at the end of semantic analysis. D compiler doesn't have
lexical forward reference bugs (except for the case of mixin) when you get
"undefined identifier" errors, but the compilation order is still here.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list