Related to 2080. ---- const s = foo(); pragma(msg, s); char[] foo() { return "Hi from foo"; } ---- Error: cannot evaluate ... you know :) Worked around by placing s declaration and pragma after foo definition
another example ---- enum { a=b() } int b(){ return 0; } ----
This bug is hit regularly when porting C to D. It's a shame that C macros don't suffer from this ordering bug :) --- #define a b(0) #define b(c) (c+1) ---
Here's patch that invokes the semantic on the function if referenced. Additioally, it needs to avoid duplicate semantic to be run later. This patch also fixes #3499 Index: expression.c =================================================================== --- expression.c (revision 421) +++ expression.c (working copy) @@ -2427,7 +2427,8 @@ f = s->isFuncDeclaration(); if (f) { //printf("'%s' is a function\n", f->toChars()); - + if (!f->originalType && f->scope) // semantic not yet run + f->semantic(f->scope); if (!f->type->deco) { error("forward reference to %s", toChars()); Index: func.c =================================================================== --- func.c (revision 421) +++ func.c (working copy) @@ -134,7 +134,7 @@ parent = sc->parent; Dsymbol *parent = toParent(); - if (semanticRun == PASSsemanticdone) + if (semanticRun >= PASSsemanticdone) // BUG 2085 { if (!parent->isClassDeclaration()) return;
Although bug 4075 appears similar to this one, the patch doesn't fix it.
changeset 478
*** Issue 2513 has been marked as a duplicate of this issue. ***
dlang/dub pull request #2098 "Fix #2085: [visuald] spurious library project" was merged into master: - d2e8c03f89c52b6b57d12449acb87e1b67cd831b by Bastiaan Veelo: If no output is generated (TargetType.none) then don't generate a project configuration. This prevents VS from attempting to build a library with no name from no sources. Fixes #2085. - cf4a049bf8755fb988a1adf3adbf709dc025841b by Bastiaan Veelo: Test issue #2085. https://github.com/dlang/dub/pull/2098
AltStyle によって変換されたページ (->オリジナル) / アドレス: モード: デフォルト 音声ブラウザ ルビ付き 配色反転 文字拡大 モバイル