www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 4680] New: Duplicated function/overload error message

reply d-bugmail puremagic.com writes:
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 puremagic.com
        ReportedBy: bearophile_hugs eml.cc



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: -------
Aug 19 2010
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4680




This shows a related problem:

http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D.learn&article_id=22302

 And a note: had forgotten to add an empty main(), just for compiling:
 the linker produced a rather big amount of error text without any hint
 to the actual issue. Maybe dmd could cope with that before calling gcc?
I agree, it's better if DMD gives a nice and clean error message when the main() is missing. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 14 2010
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4680


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 1003 ***

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