[Issue 2810] Bogus forward reference error with auto function
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Jan 2 12:48:17 PST 2011
http://d.puremagic.com/issues/show_bug.cgi?id=2810
Witold Baryluk <baryluk at smp.if.uj.edu.pl> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |baryluk at smp.if.uj.edu.pl
--- Comment #9 from Witold Baryluk <baryluk at smp.if.uj.edu.pl> 2011-01-02 12:46:04 PST ---
Hi,
I also have similar problem, but involving two modules. Minimal test case (it
also appears when functions are templates, or returns templated classes, or int
type is changed to other type):
/*****************************/
module m2;
auto f(int x) {
return x;
}
auto g(int x) {
return f(x);
}
/*****************************/
/*****************************/
module m1;
import m2 : g;
void main() {
g(5);
}
/*****************************/
It currently depend on the order of files given to the compiler.
# dmd2 m1.d m2.d # error
m1.d(6): Error: forward reference to g
# dmd2 m2.d m1.d # works!
#
# dmd2 -c m1.d # error
m1.d(6): Error: forward reference to g
# dmd2 -c m2.d # works
#
As one can see there is actually NO forward references here. So I think it is
simpler than co-recursive version of Steven. Bug disappears when function f and
g, are moved to module m1. Or when function g have explicit return type.
It maybe also related to the bug involving order of files on command line to
the compiler.
Thanks.
--
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