[Bug c++/69681] C/C++ FEs do not consider comparisons of distinct function pointers to be constant expressions

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Dec 21 13:51:00 GMT 2016


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

--- Comment #7 from Jonathan Wakely <redi at gcc dot gnu.org> ---
There's no need to determine the addresses, only the truth of the inequality.

The standard says distinct functions have distinct addresses. Yes, linker
trickery can break that, but it's reasonable to rely on it because it's
guaranteed by the standard. Code that cares about addresses of functions
(typically when registering callbacks) is unlikely to care about comparing
addresses of builtins or functions in libgcc, only for user code.


More information about the Gcc-bugs mailing list