www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 23004] New: importC: calling function pointer named 'init' or

https://issues.dlang.org/show_bug.cgi?id=23004

          Issue ID: 23004
           Summary: importC: calling function pointer named 'init' or
                    'stringof' from struct or union pointer gives error
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: ImportC, rejects-valid
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: duser neet.fi
                CC: duser neet.fi

struct { void(*init)(); void(*stringof)(); } *sp;
union { void(*init)(); void(*stringof)(); } *up;
void fn()
{
        sp->init();
        sp->stringof();
        up->init();
        up->stringof();
}

test.c(5): Error: function expected before `()`, not `null` of type `__tag2*`
test.c(6): Error: function expected before `()`, not `"sp"` of type `char*`
test.c(7): Error: function expected before `()`, not `null` of type `__tag3*`
test.c(8): Error: function expected before `()`, not `"up"` of type `char*`

--
Apr 10 2022