https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68703
Martin Sebor <msebor at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |msebor at gcc dot gnu.org --- Comment #3 from Martin Sebor <msebor at gcc dot gnu.org> --- This problem isn't limited to attribute vector_size but affects attribute aligned as well, to an even greater extent: While G++ makes it possible to overload functions on the former, it rejects overloads on the latter (it seems to "lose" the attribute from a type). The manual doesn't make it clear which is intended, leading to confusion such as in bug 71463 where users don't know whether to expect an attribute to affect the type of an object or in what contexts (__typeof__, decltype, template parameters, etc.) $ (cat y.C && set -x && for a in aligned vector_size; do /build/gcc-trunk-svn/gcc/xgcc -B /build/gcc-trunk-svn/gcc -DX=$a -S -Wall -Wextra y.C; done) typedef int X16 __attribute__ ((X (16))); typedef int X32 __attribute__ ((X (32))); int f (X16*); void f (X32*); int g16 () { X16 x; return f (&x); } void g32 () { X32 x; return f (&x); } template <int N> auto h () { int x __attribute__ ((X (N))); return f (&x); } + for a in aligned vector_size + /home/msebor/build/gcc-trunk-svn/gcc/xgcc -B /home/msebor/build/gcc-trunk-svn/gcc -DX=aligned -S -Wall -Wextra y.C y.C:5:6: error: ambiguating new declaration of ‘void f(X32*)’ void f (X32*); ^ y.C:4:5: note: old declaration ‘int f(X16*)’ int f (X16*); ^ y.C: In function ‘void g32()’: y.C:16:15: error: return-statement with a value, in function returning 'void' [-fpermissive] return f (&x); ^ + for a in aligned vector_size + /home/msebor/build/gcc-trunk-svn/gcc/xgcc -B /home/msebor/build/gcc-trunk-svn/gcc -DX=vector_size -S -Wall -Wextra y.C y.C: In function ‘auto h()’: y.C:23:15: error: no matching function for call to ‘f(int*)’ return f (&x); ^ y.C:4:5: note: candidate: int f(X16*) int f (X16*); ^ y.C:4:5: note: no known conversion for argument 1 from ‘int*’ to ‘X16* {aka __vector(4) int*}’ y.C:5:6: note: candidate: void f(X32*) void f (X32*); ^ y.C:5:6: note: no known conversion for argument 1 from ‘int*’ to ‘X32* {aka __vector(8) int*}’