Thread overview
[Issue 8108] New: Forward declaration and implementation allowed in same file
May 16, 2012
Manu
Jun 12, 2012
Walter Bright
Nov 01, 2012
Walter Bright
May 16, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8108

           Summary: Forward declaration and implementation allowed in same
                    file
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: turkeyman@gmail.com


--- Comment #0 from Manu <turkeyman@gmail.com> 2012-05-16 01:12:35 PDT ---
Currently, forward declaration is allowed, but it is presumed it is used to
describe an extern function.
I generate a lot of function implementations using magic, and I'd really like
to describe them using the natural forward declaration rather than an ugly
mixin template.
Eg:

// declare external interface
void test();
void another(int x);

// generate bindings
mixin RegisterModule; // this produces code that scans the module for functions
and generates their bodies

This compiles, but when trying to call any such function, it produces the
error:
Error: function remedy.engine.debugdraw.test called with argument types:
    (())
matches both:
    remedy.engine.debugdraw.test()
and:
    remedy.engine.debugdraw.test()

One of which is the forward declaration.
I think the forward declaration should silently yield the symbol to the actual
function definition.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
June 12, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8108


Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla@digitalmars.com
           Severity|normal                      |enhancement


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
November 01, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8108



--- Comment #1 from github-bugzilla@puremagic.com 2012-11-01 13:13:51 PDT ---
Commit pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/1857b718be782095689fb9f015d78f54f7aa95e2 fix Issue 8108 - Forward declaration and implementation allowed in same file

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
November 01, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8108


Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


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