This file: static int g() { return 42; } typeof(g) f __attribute__((__weak__, __alias__("g"))); compiled with -Wall gives: g2.c:3:12: warning: function 'g' is not needed and will not be emitted [-Wunneeded-internal-declaration] even though the function is emitted: .file "g2.c" .text .align 16, 0x90 .type g,@function g: # @g .cfi_startproc # BB#0: movl $42, %eax ret .Ltmp0: .size g, .Ltmp0-g .cfi_endproc .weak f f = g .section ".note.GNU-stack","",@progbits
This is a consequence of the fact that semantic analysis doesn't try to associate __alias__ with the targeted decl.