template TypeTuple(T...) { alias T TypeTuple; } template foobar(T) { enum foobar = 2; } void main() { foreach(sym; TypeTuple!(int, double)) // OK pragma(msg, sym.stringof); foreach(sym; TypeTuple!(foobar)) // OK pragma(msg, sym.stringof); foreach(sym; TypeTuple!(main)) // OK pragma(msg, sym.stringof); foreach(sym; TypeTuple!(int, foobar)) // Error: type int has no value pragma(msg, sym.stringof); foreach(sym; TypeTuple!(int, main)) // Error: type int has no value pragma(msg, sym.stringof); } ---- As soon as a symbol is part of the tuple it is treated as expression tuple. Foreach with an expression tuple then tries to use each tuple element as initializer which fails for types.
https://github.com/D-Programming-Language/dmd/pull/667
Commit pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/992fe402c66b554253ecc8c624a336f6e372e017 Merge pull request #667 from 9rnsr/fix7406 Issue 7406 - tuple foreach doesn't work with mixed tuples
Commit pushed to dmd-1.x at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/14e3bb9c533c178478c7b8a002b8dc05d58f722f fix Issue 7406 - tuple foreach doesn't work with mixed tuples
AltStyle によって変換されたページ (->オリジナル) / アドレス: モード: デフォルト 音声ブラウザ ルビ付き 配色反転 文字拡大 モバイル