[Issue 4680] New: Duplicated function/overload error message

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Aug 19 06:57:43 PDT 2010


http://d.puremagic.com/issues/show_bug.cgi?id=4680

           Summary: Duplicated function/overload error message
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Keywords: diagnostic
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at eml.cc 2010-08-19 06:57:39 PDT ---
This is a wrong D2 program:

int x = 1;
int x = 1;
void main() {}


dmd 2.048 prints a good enough error message:
test.d(2): Error: variable test.x conflicts with variable test.x at test.d(1)


This is another wrong D2 program:


void foo() {}
void foo() {}
void main() {}


But here dmd 2.048 on Windows shows a link error:

OPTLINK (R) for Win32  Release 8.00.2
Copyright (C) Digital Mars 1989-2009  All rights reserved.
http://www.digitalmars.com/ctg/optlink.html
test.obj(test)  Offset 00151H Record Type 00C3 
 Error 1: Previous Definition Different : _D4test3fooFZv


In my opinion here it's better for dmd to spot the function foo() duplication
and give a cleaner error message, something like:

test.d(2): Error: function test.foo() has the same signature as the function
test.foo() at test.d(1)

This bug may happen if a function is duplicated, or if the overloading is done
in a wrong way.

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


More information about the Digitalmars-d-bugs mailing list