[This is a copy of a bug that I posted a year ago on ubuntu's launchpad.
Nothing happened there, and now I am still observing the same problem
with gcc 4.4.1 on a newly upgraded ubuntu 9.10]
Compiling the following with g++
void toto1(double*const __attribute__((aligned(16))) X);
void toto2(double* const (&X)[1]);
produdes
g++ -c -o test.o test.cc
test.cc:2: error: alignment of array elements is greater than element size
Observe the `2' in the error message, the error is reported for toto2.
(For toto1 an error would be acceptable, I think).
But even worse, if we take
void toto0(double* const (&X)[1]);
void toto1(double*const __attribute__((aligned(16))) X);
void toto2(double* const (&X)[1]);
All three prototypes compile flawlessly.
--
Summary: g++ produces spurious alignment errors for prototypes
Product: gcc
Version: 4.4.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: jens dot gustedt at loria dot fr
GCC build triplet: i486-linux-gnu
GCC host triplet: i486-linux-gnu
GCC target triplet: i486-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41966