digitalmars.D.learn - recursive alias declaration
- Namespace (25/25) Jul 23 2013 Did I miss something or is this a bug?
- =?UTF-8?B?QWxpIMOHZWhyZWxp?= (3/26) Jul 23 2013 Looks like a bug to me.
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.
Jul 23 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
Jul 23 2013








=?UTF-8?B?QWxpIMOHZWhyZWxp?= <acehreli yahoo.com>