auto
language_fan
foo at bar.com.invalid
Wed Aug 12 08:19:10 PDT 2009
Wed, 12 Aug 2009 10:22:22 -0400, Jarrett Billingsley thusly wrote:
> but DMD crashes. :P
Who would have guessed! It would help if the compiler knew how to do
semantic analysis.. here are a couple of additional test cases - a type
checker for these can be written in approximately 30 minutes in Prolog or
SML or something similar.
# auto foo() { return 1; }
# pragma(msg, typeof(foo).stringof);
# void main() {
# foo();
# }
: foo.d(3): Error: forward reference to foo
: foo.d(3): Error: forward reference to inferred return type of function
call (())()
: (())()
# auto foo(int a) { return a>0 ? foo(a-1) : a; }
# void main() {
# foo(0);
#}
: foo.d(1): Error: forward reference to foo
: foo.d(1): Error: forward reference to inferred return type of function
call foo(a - 1)
More information about the Digitalmars-d
mailing list