This bug was created from Bug 2687. Workaround (D2), change the foreach to enum args_length = args.length; foreach( x ; Range!(args_length) ){ } --- template Tuple(T...){ alias T Tuple; } template Range(int b){ alias Tuple!(1) Range; } void foo()(){ Tuple!(int, int) args; foreach( x ; Range!(args.length) ){ } } void main(){ foo!()(); } --- ice.d(411): Error: identifier 'length' of 'args.length' is not defined ice.d(411): Error: template instance Range!(int) does not match template declara tion Range(int b) ice.d(411): Error: foreach: void is not an aggregate type ice.d(416): Error: template instance ice.foo!() error instantiating
Ran into something similar a while back, but I don't think foreach has anything to do with it: template Sequenced(){ template Inner(ThisNode, Value, size_t N){ } } struct IndexedBy(L...) { alias L List; } class MIC(IndexedBy){ alias int ThisNode; void _RemoveAllBut(size_t N)(ThisNode* node){ } /// disattach node from all indeces. alias _RemoveAllBut!(IndexedBy.List.length) _RemoveAll; } void main(){ alias MIC!(IndexedBy!(Sequenced!())) C; } yields 1 error message: Error: identifier 'length' of 'IndexedBy.List.length' is not defined
Reduced form of the test case in comment 1: --------- template Sequenced() {} struct IndexedBy(L...) { alias L List; } struct MIC(F){ int[F.List.length] w; } alias MIC!( IndexedBy!(Sequenced!()) ) C; ---------- test3.d(14): Error: identifier 'length' of 'F.List.length' is not defined test3.d(17): Error: template instance test3.MIC!(IndexedBy!(__T9SequencedZ)) err or instantiating Looks like a failure to resolve aliases, for a template which is a member of a tuple.
https://github.com/D-Programming-Language/dmd/pull/407
https://github.com/D-Programming-Language/dmd/commit/3df93ae2529bc71c65aecdd819d91428a21d7185 https://github.com/D-Programming-Language/dmd/commit/0cd550b4d4655259ac69a676908e702d65cdc94f
AltStyle によって変換されたページ (->オリジナル) / アドレス: モード: デフォルト 音声ブラウザ ルビ付き 配色反転 文字拡大 モバイル