[Issue 8108] New: Forward declaration and implementation allowed in same file

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed May 16 01:11:04 PDT 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 at puremagic.com
        ReportedBy: turkeyman at gmail.com


--- Comment #0 from Manu <turkeyman at 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: -------


More information about the Digitalmars-d-bugs mailing list