www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 22531] New: importC: D name mangling applied to forward


          Issue ID: 22531
           Summary: importC: D name mangling applied to forward
                    declaration of function inside function
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: duser airmail.cc

int main(void)
        void fn(void);
        return 0;
void fn(void)

% dmd -run example.c
example.o: in function `main':
example.c:(.text.main[main]+0x5): undefined reference to `_D2c14mainUZ2fnUZv'
collect2: error: ld returned 1 exit status
Error: linker exited with status 1

similar bug from "possible duplicates":

Nov 21 2021