810 – Cannot forward reference template

D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 810 - Cannot forward reference template
Summary: Cannot forward reference template
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D1 (retired)
Hardware: x86 All
: P3 normal
Assignee: No Owner
URL:
Keywords: rejects-valid
Depends on:
Blocks: 340 945
Show dependency tree / graph
Reported: 2007年01月07日 05:42 UTC by Matti Niemenmaa
Modified: 2014年02月15日 13:13 UTC (History)
2 users (show)

See Also:


Attachments
Add an attachment (proposed patch, testcase, etc.)

Note You need to log in before you can comment on or make changes to this issue.
Description Matti Niemenmaa 2007年01月07日 05:42:55 UTC
They don't get much shorter than this:
Template!(int) stack;
template Template(T) {}
Flip the two lines and the code compiles.
Comment 2 Don 2009年08月19日 07:23:24 UTC
This test case is faulty (as are the Dstress cases), it should be:
Template!(int) stack;
template Template(T) { alias int Template; }
This failed in 1.041, but is working in 1.046 and 2.031. 
I bet this was fixed by bug#106 in 1.046.
Comment 3 Matti Niemenmaa 2009年08月19日 09:49:00 UTC
Right you are; I checked and indeed, flipping the two lines doesn't make the code acceptable even with DMD 1.00. My bad, I presumably changed it from "class" to "template" at the last minute.
Confirmed that this is indeed fixed with 1.046: it didn't work in 1.045. Happy days! My code is riddled with "waiting on #810"-type comments.


AltStyle によって変換されたページ (->オリジナル) /