Bug 6233 – Compiler lists wrong module in an expression error
Status
RESOLVED
Resolution
DUPLICATE
Severity
major
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
Other
OS
Windows
Creation time
2011-06-30T18:51:00Z
Last change time
2011-08-04T19:46:50Z
Assigned to
nobody
Creator
andrej.mitrovich
Comments
Comment #0 by andrej.mitrovich — 2011-06-30T18:51:11Z
This happened in real code due to a mishap where I've accidentally removed the name of a function in a function call.
.\test.d:
module test;
import bar.barmod;
void main()
{
(FALSE); // used to be Foo(FALSE);
}
void Foo(BOOL) { }
.\bar\barmod.d:
module bar.barmod;
alias int BOOL;
enum : BOOL {
FALSE = 0,
TRUE = 1
}
$ dmd test.d -I.
bar\barmod.d(5): Error: long has no effect in expression (0)
In my case it pointed the error to the WinAPI library, that was a real WTF moment and it took me a while before I spotted where the syntax error really was.
Comment #1 by andrej.mitrovich — 2011-08-03T09:32:16Z
Simplified test case:
foo.d:
import bar;
void main()
{
return TRUE;
}
bar.d:
enum TRUE = 1;
$ rdmd foo.d:
bar.d(1): Error: long has no effect in expression (1)
I'm raising the priority because it's extremely infuriating getting an error message that points to a completely different module, making this bug hard to track.
Comment #2 by yebblies — 2011-08-04T19:46:50Z
*** This issue has been marked as a duplicate of issue 3630 ***