www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 8723] New: Error: function called with argument types:

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

           Summary: Error: function called with argument types:
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: maxim maxim-fomin.ru



---
void foo();

void foo()
{

}

void main()
{
    foo(); // here
}

----------------------

hello.d(10): Error: function hello.foo called with argument types:
    (())
matches both:
    hello.foo()
and:
    hello.foo()
-----------------------

Clearly it is a bug.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 25 2012
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8723


Jonathan M Davis <jmdavisProg gmx.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jmdavisProg gmx.com



PDT ---
Why is that clearly a bug? You gave two functions with identical function
signatures. The only time that you give function prototypes in D are when
you're _not_ providing the source (e.g. inside of .di files or version(D_Ddoc)
blocks).

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 25 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8723




---

 Why is that clearly a bug? You gave two functions with identical function
 signatures. The only time that you give function prototypes in D are when
 you're _not_ providing the source (e.g. inside of .di files or version(D_Ddoc)
 blocks).
No, I gave one function prototype (declaration) and one function definition with similar name and type. The former has to be binded to the latter. This is how C works and D should follow it in this regard. There is no reason for assuming that prototypes and definitions are separated between different modules and no reason for making feigned ambiguity between function body and its own declaration. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 25 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8723




---
By the way, following code is not compiled either (for the same reason):

struct S;

struct S {}

void main()
{

}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 25 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8723


bearophile_hugs eml.cc changed:

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



According to D specs I think there are no bugs here. So at best those are two
enhancement requests.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 25 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8723




PDT ---
And why on earth would you _need_ a prototype? This isn't C. We're not forced
to declare functions higher up in a file before using them. Ideally, prototypes
wouldn't even _exist_. They're an artifact of C's poor compilation model.

Unfortunately, they're necessary for .di files, so we have them, but there's no
reason whatsoever to be declaring a prototype in a .d file.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 25 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8723


Maxim Fomin <maxim maxim-fomin.ru> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 25 2012
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8723


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |andrej.mitrovich gmail.com
         Resolution|                            |INVALID


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