D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 6233 - Compiler lists wrong module in an expression error
Summary: Compiler lists wrong module in an expression error
Status: RESOLVED DUPLICATE of issue 3630
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: Other Windows
: P2 major
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-06-30 18:51 UTC by Andrej Mitrovic
Modified: 2011-08-04 19:46 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Andrej Mitrovic 2011-06-30 18:51:11 UTC
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 Andrej Mitrovic 2011-08-03 09:32:16 UTC
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 yebblies 2011-08-04 19:46:50 UTC

*** This issue has been marked as a duplicate of issue 3630 ***