Consider: === Module a.d === enum { A, B, C } === Module b.d === import a; // ... thousands of lines of code ... void foo() { A; } // ... thousands of lines of code ... ================== The error message outputted by the compiler will look like this: a.d(1): Error: long has no effect in expression (0) This is more serious considering that starting with 1.049, DMD forbids return expressions without side effects inside void functions. In my particular case, this was with the pretty-large DFL library, which required quite a bit of "divide-et-impera" to find the offending code. By quickly looking at the compiler code, it looks like this happens because the expression statement is using the expression directly from the enumeration. The fix would involve instantiating an enum-reference expression each time an enumeration member is mentioned, or something like that.
*** Issue 3746 has been marked as a duplicate of this issue. ***
*** Issue 6233 has been marked as a duplicate of this issue. ***
https://github.com/D-Programming-Language/dmd/pull/750
Commit pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/021f361bf01f91e76ccf2bc90483bce857149b54 Merge pull request #750 from yebblies/issue3630 Issue 3630 - bad error location in "has no effect in expression" error
Commit pushed to dmd-1.x at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/f3ab2da302e894498bd4cfc71cacda844c4f8120 fix Issue 3630 - bad error location in has no effect in expression error
I am seeing this, I don't know why: dmc -c -Iroot;\dm\include -o -cpp func e = p->type->defaultInitLiteral(); ^ func.c(2488) : Error: 1 actual arguments expected for function, had 0 --- errorlevel 1
(In reply to comment #6) > I am seeing this, I don't know why: > > > dmc -c -Iroot;\dm\include -o -cpp func > e = p->type->defaultInitLiteral(); > ^ > func.c(2488) : Error: 1 actual arguments expected for function, had 0 > --- errorlevel 1 Because Walter merged pull 41 which added that code. I'm glad I took away the default parameter, we just avoided a new missing line number bug.
AltStyle によって変換されたページ (->オリジナル) / アドレス: モード: デフォルト 音声ブラウザ ルビ付き 配色反転 文字拡大 モバイル