www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 8108] New: Forward declaration and implementation allowed in same file

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



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: -------
May 16 2012
next sibling parent d-bugmail puremagic.com writes:
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: -------
Jun 12 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8108




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: -------
Nov 01 2012
prev sibling parent d-bugmail puremagic.com writes:
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: -------
Nov 01 2012