Thread overview
[Issue 2826] New: failed assignment gives wrong line number
Apr 09, 2009
d-bugmail
Oct 12, 2009
Rob Jacques
Oct 21, 2009
Don
April 09, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2826

           Summary: failed assignment gives wrong line number
           Product: D
           Version: 2.027
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Keywords: diagnostic, patch
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla@digitalmars.com
        ReportedBy: clugdbug@yahoo.com.au


const float foo=200.0;

void main() {
  int y = foo;
}
-----------
fog.d(1): Error: cannot implicitly convert expression (200) of type
const(float)
 to int

But the error is on line 4, not on line 1.
================
Patch: optimize.c line 128. The problem is that isVarDeclaration() on line 119
returns an expression with the line number where the initializer was from. But,
we want the line number for the assignment.
This patch fixes it, but I think there's something deeper which is wrong here.
There are many similar alias bugs in bugzilla.

--- optimize.c  (revision 23)
+++ optimize.c  (working copy)
@@ -124,6 +124,7 @@
                e = e->copy();
                e->type = e1->type;
            }
+               e->loc = e1->loc;
        }
        else
            e = e1;


-- 

October 12, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2826


Rob Jacques <sandford@jhu.edu> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |sandford@jhu.edu


--- Comment #1 from Rob Jacques <sandford@jhu.edu> 2009-10-12 09:56:20 PDT ---
Fixes in DMD 2.034 have exacerbated this issue. Specifically, this effects all void return functions with a non-void return somewhere in the function. Also, note that the error may be in a completely different file, making it harder to track down.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
October 21, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2826


Don <clugdbug@yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


--- Comment #2 from Don <clugdbug@yahoo.com.au> 2009-10-21 06:40:38 PDT ---
Fixed DMD2.035.

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