www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 7600] New: Generate better error message with lvalue mismatch

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

           Summary: Generate better error message with lvalue mismatch
           Product: D
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: andrej.mitrovich gmail.com



06:28:13 PST ---
void foo(ref string x) { }
void bar(ref int x) { }

void main()
{
    foo("var");
    immutable int x;
    bar(x);
}

test.d(8): Error: function test.foo (ref string x) is not callable using
argument types (string)

test.d(10): Error: function test.bar (ref int x) is not callable using argument
types (immutable(int))
test.d(10): Error: constant 0 is not an lvalue

The error for the 'foo' function should generate two error messages just like
the error for 'bar. 

It could print: 'Error: constant "var" is not an lvalue'. This is especially
useful in templated functions.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 27 2012
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7600


bearophile_hugs eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bearophile_hugs eml.cc





 test.d(8): Error: function test.foo (ref string x) is not callable using
 argument types (string)
 
 test.d(10): Error: function test.bar (ref int x) is not callable using argument
 types (immutable(int))
 test.d(10): Error: constant 0 is not an lvalue
 
 The error for the 'foo' function should generate two error messages just like
 the error for 'bar. 
 
 It could print: 'Error: constant "var" is not an lvalue'. This is especially
 useful in templated functions.
Or maybe better, generate a single error message in both cases, something like: test.d(10): Error: function test.bar (ref int x) is not callable using argument types (immutable(int)), constant 0 is not an lvalue. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 27 2012