Thread overview
[Issue 8723] New: Error: function called with argument types:
Sep 25, 2012
Maxim Fomin
Sep 25, 2012
Jonathan M Davis
Sep 25, 2012
Maxim Fomin
Sep 25, 2012
Maxim Fomin
Sep 25, 2012
Jonathan M Davis
Sep 26, 2012
Maxim Fomin
Oct 21, 2012
Andrej Mitrovic
September 25, 2012
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


--- Comment #0 from Maxim Fomin <maxim@maxim-fomin.ru> 2012-09-25 05:30:35 PDT ---
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: -------
September 25, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8723


Jonathan M Davis <jmdavisProg@gmx.com> changed:

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


--- Comment #1 from Jonathan M Davis <jmdavisProg@gmx.com> 2012-09-25 09:51:18 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: -------
September 25, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8723



--- Comment #2 from Maxim Fomin <maxim@maxim-fomin.ru> 2012-09-25 11:35:45 PDT ---
(In reply to comment #1)
> 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: -------
September 25, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8723



--- Comment #3 from Maxim Fomin <maxim@maxim-fomin.ru> 2012-09-25 11:37:57 PDT ---
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: -------
September 25, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8723


bearophile_hugs@eml.cc changed:

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


--- Comment #4 from bearophile_hugs@eml.cc 2012-09-25 12:12:49 PDT ---
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: -------
September 25, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8723



--- Comment #5 from Jonathan M Davis <jmdavisProg@gmx.com> 2012-09-25 13:10:26 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: -------
September 26, 2012
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: -------
October 21, 2012
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: -------