www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 22842] New: importC: Error: variable 'fun' cannot be declared


          Issue ID: 22842
           Summary: importC: Error: variable 'fun' cannot be declared to
                    be a function
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: ibuclaw gdcproject.org

Declaring functions has two equivalent syntaxes.
int fun();
typedef int (tfunc)();
tfunc fun;

The latter is however rejected by the compiler.

Related code results in "Error: function 'fun' conflicts with variable 'fun'"
typedef int (myfunc)();
static myfunc fun;

int main()
    return fun();

int fun() // inherits "static" from declaration.
    return 0;

Mar 03 2022