Bug 10705 – recursive alias declaration

Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-07-23T11:11:00Z
Last change time
2017-07-03T17:07:16Z
Assigned to
nobody
Creator
rswhite4

Comments

Comment #0 by rswhite4 — 2013-07-23T11:11:12Z
---- import std.stdio; struct Rect(T) { public: bool intersects(ref const Rect!T rhs, ShortRect* overlap = null) { return false; } } alias FloatRect = Rect!float; alias ShortRect = Rect!short; void main() { } ---- print: tpl_bug.d(11): Error: alias tpl_bug.ShortRect recursive alias declaration tpl_bug.d(11): Error: template instance tpl_bug.Rect!(short) error instantiating tpl_bug.d(10): Error: template instance tpl_bug.Rect!(float) error instantiating dmd 2.063.2, Windows Seems the Compiler is a bit confused. If I change 'ShortRect' to 'Rect!short' or 'Rect!T' everything works fine.
Comment #1 by Jesse.K.Phillips+D — 2014-06-25T03:26:37Z
Before the compiler can define what ShortRect is it must first create a Rect!short, to create a Rect!short it needs to know what a ShortRect is. This might be more of an enhancement than bug.
Comment #2 by dlang-bugzilla — 2017-07-03T17:07:16Z
Fixed by https://github.com/dlang/dmd/pull/3822. *** This issue has been marked as a duplicate of issue 13204 ***