[Bug c++/69681] C/C++ FEs do not consider comparisons of distinct function pointers to be constant expressions
ppalka at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Feb 5 01:48:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69681
--- Comment #1 from Patrick Palka <ppalka at gcc dot gnu.org> ---
(Sorry about the typos in the original comment. To fix them,
s/since both foo and bar/since both foo and bar are/
s/when comparing and pointers/when comparing pointers/
s/the subsequent declarations/then subsequent declarations/)
An interesting case is:
__attribute__ ((weak)) void foo () { }
void bar () { }
int x[(int)(&foo != &bar)];
Where just one of the functions is declared weak. Could foo be defined in
another CU as
__attribute__ ((alias ("bar")) void foo () { } ?
Apparently not, since the symbol being aliased must be defined in the same CU
as the alias. So I think "&foo != &bar" could be folded if only one of the
functions is declared weak.
More information about the Gcc-bugs
mailing list