Joseph, while looking into implementing enhancement your request pr81824 I noticed that GCC silently accepts incompatible alias declarations (pr81854) so as sort of a proof-concept for the former I enhanced the checking already done for other kinds of incompatibilities to also detect those mentioned in the latter bug. Attached is this patch, tested on x85_64-linux. Jonathan, the patch requires suppressing the warning in libstdc++ compatibility symbol definitions in compatibility.cc. I couldn't find a way to do it without the suppression but I'd be happy to try again if you have an idea for how. As an example, the patch lets GCC detect mistakes like: size_t __attribute__ ((ifunc ("bar_resolver"))) bar (void*, const void*, size_t); void* fast_bar (void *d, const void *s, size_t n) { ... } void* slow_bar (void *d, const void *s, size_t n) { ... } void* bar_resolver (void) { return fast ? &fast_bar : &slow_bar; } By complaining that the ifunc resolver should return a function pointer it makes the programmer change the declaration of the resolver to one of: __typeof__ (bar)* bar_resolver (void) { ... } or __typeof__ (fast_bar)* bar_resolver (void) { ... } which then triggers either -Wincompatible-pointer-types or -Wattributes, respectively. (I used the latter warning in my patch but maybe the former would be more appropriate). Martin PS A documentation-only patch to update the description of attribute ifunc was posted separately here: https://gcc.gnu.org/ml/gcc-patches/2017-08/msg01095.html PPS To make use of this checking (and compile without the new warnings) Glibc needs the following patch: diff --git a/include/libc-symbols.h b/include/libc-symbols.h index fe3ab81..5413e56 100644 --- a/include/libc-symbols.h +++ b/include/libc-symbols.h @@ -790,7 +790,8 @@ for linking") /* Helper / base macros for indirect function symbols. */ #define __ifunc_resolver(type_name, name, expr, arg, init, classifier) \ - classifier inhibit_stack_protector void *name##_ifunc (arg) \ + classifier inhibit_stack_protector \ + __typeof (type_name) *name##_ifunc (arg) \ { \ init (); \ __typeof (type_name) *res = expr; \