www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 6233] New: Compiler lists wrong module in an expression error

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6233

           Summary: Compiler lists wrong module in an expression error
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: andrej.mitrovich gmail.com



18:51:11 PDT ---
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.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 30 2011
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6233


Andrej Mitrovic <andrej.mitrovich gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |major



09:32:16 PDT ---
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.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 03 2011
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6233


yebblies <yebblies gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |yebblies gmail.com
         Resolution|                            |DUPLICATE



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

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 04 2011