Code: string s = "ohai"; foreach (int i, dchar c; s) {} Error: Error: cannot evaluate _aApplycd2(s,int delegate(ref int __applyArg0, ref dchar __applyArg1) { dchar c2 = __applyArg1; int i = __applyArg0; if (cast(uint)c == cast(uint)c2) __result = i; return 2; return 0; } ) at compile time foreach(dchar c; s) also fails similarly.
This does work for me using dmd 2.037 and later but not using dmd 1.055 on Mac OS X.
I'm seeing a similar error. dmd 2.050 on OS X. Code: import std.string; void main() { mixin("int " ~ tolower("A") ~ ";"); } Error: /Users/drothlis/dmd2/osx/bin/../../src/phobos/std/string.d(792): Error: _aApplycd2 cannot be interpreted at compile time, because it has no available source code minimal.d(5): Error: cannot evaluate tolower("A") at compile time
(In reply to comment #2) Whereas the original code posted by Bill Baxter compiles successfully.
(In reply to comment #3) Please ignore comment #3 :)
This still fails, and will most likely be fixed by issue 6268.
*** Issue 6268 has been marked as a duplicate of this issue. ***
https://github.com/D-Programming-Language/dmd/commit/9318dc44c3e9aa75907966b9fd122c0cc6700891 https://github.com/D-Programming-Language/dmd/commit/571661646ca420aa4c3fb348e86e35ed8faae624
AltStyle によって変換されたページ (->オリジナル) / アドレス: モード: デフォルト 音声ブラウザ ルビ付き 配色反転 文字拡大 モバイル