recursive alias declaration

Ali Çehreli acehreli at yahoo.com
Tue Jul 23 10:28:19 PDT 2013


On 07/23/2013 10:00 AM, Namespace wrote:
> Did I miss something or is this a bug?
>
> ----
> 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* overlap'
> to 'Rect!short' or 'Rect!T' everything works fine.

Looks like a bug to me.

Ali



More information about the Digitalmars-d-learn mailing list