July 23, 2013 recursive alias declaration | ||||
|---|---|---|---|---|
| ||||
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.
| ||||
July 23, 2013 Re: recursive alias declaration | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Namespace | 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
| |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply