Bug 12261 – [REG2.066a] alias T cannot bind to templated type
Status
RESOLVED
Resolution
INVALID
Severity
regression
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-02-25T22:52:00Z
Last change time
2014-08-15T14:13:37Z
Assigned to
nobody
Creator
timothee.cour2
Comments
Comment #0 by timothee.cour2 — 2014-02-25T22:52:00Z
struct A1(T){}
template isAliasable(alias T)
{
enum isAliasable=true;
}
template isAliasable(T)
{
enum isAliasable=false;
}
void main(){
alias foo=A1!double; //this works
static assert(isAliasable!(A1!double)); //ok in 2.064.2; CT error in 2.065 even though previous line ok
}
Comment #1 by timothee.cour2 — 2014-02-25T22:56:58Z
Actually this also fails with:
struct A2{}
static assert(isAliasable!(A2)); //ok in 2.064.2; CT error in 2.065
Is that a bugfix or a bug?
Comment #2 by dlang-bugzilla — 2014-02-25T23:52:29Z
This only manifests in git, not the released 2.065, right?
Comment #3 by dlang-bugzilla — 2014-02-26T00:08:45Z
Introduced in https://github.com/D-Programming-Language/dmd/pull/3210.
Looking at that pull's testcases, this might be an intentional change - (T) is more specialized than (alias T), as all types can be aliases but not all aliases are types.
Comment #4 by k.hara.pg — 2014-02-26T00:33:49Z
(In reply to comment #3)
> Introduced in https://github.com/D-Programming-Language/dmd/pull/3210.
>
> Looking at that pull's testcases, this might be an intentional change - (T) is
> more specialized than (alias T), as all types can be aliases but not all
> aliases are types.
Yes, the current behavior has practical benefit that:
template isAliasable(alias T) { pragma(msg, T); }
template isAliasable(T) { pragma(msg, T); }
struct A1(T) {}
struct A2{}
alias a1 = isAliasable!(const A1!double);
alias a2 = isAliasable!(const A2);
With 2.065:
A1!double
A2
--> type qualifier information has lost
With 2.066a:
const(A1!double)
const(A2)
--> accessible to the full information
Comment #5 by k.hara.pg — 2014-03-01T00:24:27Z
Marked as invalid.
Comment #6 by dlang-bugzilla — 2014-08-15T14:13:37Z
*** Issue 13296 has been marked as a duplicate of this issue. ***