[Issue 5601] A template forward reference error
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Nov 22 01:47:40 PST 2013
https://d.puremagic.com/issues/show_bug.cgi?id=5601
Kenji Hara <k.hara.pg at gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Version|D1 & D2 |D2
Resolution| |INVALID
--- Comment #3 from Kenji Hara <k.hara.pg at gmail.com> 2013-11-22 01:47:37 PST ---
(In reply to comment #0)
> A case of forward template forward reference (I am not sure this is actually a
> bug):
>
>
> import std.traits;
> auto foo() {
> alias ReturnType!foo T;
> return 0;
> }
> void main() {}
>
>
> DMD 2.052 shows (it's not a regression):
>
> ...\dmd\src\phobos\std\traits.d(122): Error: template instance forward
> reference of foo
> ...\dmd\src\phobos\std\traits.d(105): Error: forward reference to foo
> ...\dmd\src\phobos\std\traits.d(122): Error: template instance
> std.traits.staticLength!(foo) error instantiating
This is correct behavior. Before function body semantic finished, getting type
of auto function will cause forward reference error since its return type is
not determined.
--
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list