4267 – forward reference error when 2-fold aliasing a template instance

D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 4267 - forward reference error when 2-fold aliasing a template instance
Summary: forward reference error when 2-fold aliasing a template instance
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P2 major
Assignee: No Owner
URL:
Keywords: rejects-valid
Depends on: 4503
Blocks:
Show dependency tree / graph
Reported: 2010年06月03日 15:24 UTC by Trass3r
Modified: 2014年02月15日 02:42 UTC (History)
1 user (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 Trass3r 2010年06月03日 15:24:52 UTC
alias Bar Bar2; // but the second one doesn't
alias Foo!(1) Bar; // 1 alias "level" works
//alias Bar Bar2; // putting it behind the 1st alias makes it work
template Foo(uint ver)
{
}
ddraw.d(1): Error: forward reference to 'Foo!(1)'
Comment 1 Trass3r 2010年06月03日 16:39:38 UTC
Oh and moving the alias declaration doesn't help in the real-world example:
interface IDirectDrawSurfaceB(uint ver) : IUnknown
{
...
HRESULT Initialize(LPDIRECTDRAW, LPDDSURFACEDESC ); // line 153
...
}
alias IDirectDrawSurfaceB!(1) IDirectDrawSurface; // line 199
interface IDirectDrawB(uint ver) : IUnknown
{
...
	HRESULT CreateSurface(LPDDSURFACEDESC, LPDIRECTDRAWSURFACE *, IUnknown *);
...
}
alias IDirectDrawB!(1) IDirectDraw; ///
alias IDirectDraw *LPDIRECTDRAW;
alias IDirectDrawSurface *LPDIRECTDRAWSURFACE;
ddraw.d(153): Error: forward reference to 'IDirectDrawB!(1)'
ddraw.d(153): Error: IDirectDraw is used as a type
ddraw.d(199): Error: alias ddraw.IDirectDrawSurface recursive alias declaration
ddraw.d(199): Error: template instance ddraw.IDirectDrawSurfaceB!(1) error instantiating
Comment 2 Trass3r 2010年06月03日 18:31:04 UTC
I tried using direct aliases also for the pointers to see if this solves the problem:
alias IDirectDrawB!(1) *LPDIRECTDRAW;
but it still doesn't work.
Comment 3 Walter Bright 2010年08月08日 21:33:28 UTC
Fixed with 4503


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