Bug 6475 – template identifier is not a member of alias
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2011-08-11T20:07:00Z
Last change time
2012-04-23T11:12:27Z
Keywords
pull, rejects-valid
Assigned to
nobody
Creator
ellery-newcomer
Comments
Comment #0 by ellery-newcomer — 2011-08-11T20:07:06Z
inside this issue is a forward reference error, so it might just be a dup of some other issue, but here it is anyways. A workaround exists and is expressed in the code.
dmd32 2.054
the code:
struct SignalOnChange(L...) {
static struct Inner(IndexedBy){
static auto r(){
Inner i;
return i;
}
}
}
enum UseWhatWorks = false;
struct ContainerArgs(X...){
static if(UseWhatWorks){
alias typeof(X[0].Inner!(int).r()) Signals;
}else{
alias X[0] Signals0;
alias Signals0.Inner!(int) Signals;
}
}
class MIC(RawValue, Args...){
alias ContainerArgs!(Args).Signals NormSignals;
}
void main(){
alias MIC!(int,
SignalOnChange!(int,int)) C;
}
the fireworks:
error11.d(26): Error: alias error11.ContainerArgs!(SignalOnChange!(int,int)).ContainerArgs.Signals0 template identifier Inner is not a member of alias Signals0
error11.d(26): Error: alias error11.ContainerArgs!(SignalOnChange!(int,int)).ContainerArgs.Signals0 template identifier Inner is not a member of alias Signals0
error11.d(27): Error: no property 'Inner!(int)' for type 'SignalOnChange!(int,int)'
error11.d(27): Error: alias error11.ContainerArgs!(SignalOnChange!(int,int)).ContainerArgs.Signals cannot alias an expression __error
error11.d(32): Error: template instance error11.ContainerArgs!(SignalOnChange!(int,int)) error instantiating
error11.d(36): instantiated from here: MIC!(int,SignalOnChange!(int,int))
error11.d(32): Error: forward reference to 'Signals0.Inner!(int)'
Comment #1 by ellery-newcomer — 2011-08-11T20:13:37Z
a similar issue:
struct Sequenced(){
struct Inner(){
mixin template NodeMixin(){
size_t i;
}
}
}
struct IndexedBy(L...)
{
alias L List;
}
struct MNode(ThisContainer, IndexedBy, Signals, Value){
alias Sequenced!().Inner!() ZZ; // ok
alias Sequenced!() Y0;
alias Y0.Inner!() Z0; // oh no!
}
class MIC(Value, Args...){
alias MNode!(typeof(this), Args[0],int,Value) ThisNode;
}
void main(){
alias MIC!(int,
IndexedBy!(Sequenced!(),
),
) C;
}
produces:
error12.d(25): Error: alias error12.MNode!(MIC,IndexedBy!(Sequenced!()),int,int).MNode.Y0 template identifier Inner is not a member of alias Y0
error12.d(25): Error: alias error12.MNode!(MIC,IndexedBy!(Sequenced!()),int,int).MNode.Y0 template identifier Inner is not a member of alias Y0
error12.d(26): Error: no property 'Inner!()' for type 'Sequenced!()'
error12.d(26): Error: alias error12.MNode!(MIC,IndexedBy!(Sequenced!()),int,int).MNode.Z0 cannot alias an expression __error
error12.d(30): Error: template instance error12.MNode!(MIC,IndexedBy!(Sequenced!()),int,int) error instantiating
error12.d(34): instantiated from here: MIC!(int,IndexedBy!(Sequenced!()))
Comment #2 by ellery-newcomer — 2012-02-18T12:04:15Z
and again.
dmd 2.058 64 bit
code:
class Foo(Value){
template T1(size_t n){ alias int T1; }
}
void main(){
alias Foo!(int) C2;
alias C2.T1!0 a1;
}
fireworks:
junk.d(5): Error: alias junk.main.C2 template identifier T1 is not a member of alias C2