[Bug c/83584] "ISO C forbids conversion of object pointer to function pointer type" -- no, not really

witold.baryluk+gcc at gmail dot com gcc-bugzilla@gcc.gnu.org
Sun Oct 20 13:03:00 GMT 2019


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83584

Witold Baryluk <witold.baryluk+gcc at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |witold.baryluk+gcc at gmail dot co
                   |                            |m

--- Comment #19 from Witold Baryluk <witold.baryluk+gcc at gmail dot com> ---
This is still happening, even when using -std=c11 with gcc 9.2.1

C11 does state in annex J.5.7:

http://port70.net/~nsz/c/c11/n1570.html#J.5.7p1

"""
J.5.7 Function pointer casts

1 A pointer to an object or to void may be cast to a pointer to a function,
allowing data to be invoked as a function (6.5.4). 
"""


I am not sure how else I am supposed to use `dlsym(3)`. Maybe if there was a
version of dlsym that instead of returning (void*), would return (void(*)()) or
(void (*)(void)) it would help. Maybe it is a POSIX bug then?


This issue however is not a duplicate of bug 11234. And the error message is
incorrect anyway.

Sorry if this was mentioned before.


More information about the Gcc-bugs mailing list