When preprocessing the following snippet: namespace a { typedef int vector[3]; }; typedef a::vector vector; using g++ -maltivec -E foo.cpp, then the output is # 1 "foo.cpp" # 1 "<built-in>" # 1 "<command-line>" # 1 "foo.cpp" namespace a { typedef int vector[3]; }; typedef a::vector; Notice how the final "vector" has disappeared. It seems that gcc is providing a magical #define for "vector" which is not working correctly. Using -dD, I can see #define vector vector but if I actually add this definition (or #undef vector) to the top of the file, then the output becomes correct. g++ (Gentoo 4.5.4 p1.0, pie-0.4.7) 4.5.4 Reproducible: Always Steps to Reproduce: 1. Type the above example into a file 2. Preprocess it with g++ -maltivec -E 3. Observe the result Actual Results: typedef a::vector; Expected Results: typedef a::vector vector;
Another way of getting the correct output is this: namespace a { typedef int vector[3]; }; #define DUMMY typedef a::vector DUMMY vector;
not a bug. "vector" is a gcc builtin type.
So you are saying that it is correct that namespace a { typedef int vector[3]; }; typedef a::vector vector; and namespace a { typedef int vector[3]; }; #define DUMMY typedef a::vector DUMMY vector; yield different results? And since when is the preprocessor concerned with types?
feel free to file a bug at gcc.gnu.org and cc toolchain@g.o. i've dealt with enough people getting yelling at "vector" and "__vector" to waste time on more.
Actually the problem seems to have been reported (and fixed, so much for "not a bug" :) upstreams already: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48226 So either the fix could be backported to 4.5.4, or 4.7.2 (which has the fix) unmasked for ppc(64).
For the record: The patch from the gcc bugzilla applies cleanly to gcc-4.5.4 (I put it in my /etc/portage/patches), and the resulting gcc does not exhibit the problem.
(In reply to comment #5) we don't really do arch-specific toolchain unmasking anymore. especially not gcc-4.7 right now. if there's a patch available, it's easy enough to add to the 4.5.x patchset.
queued up in all 4.5.x and 4.6.x patch series, and pushed out in current 4.5.4 and 4.6.3 ebuilds
Thanks! I confirm the issue as being resolved by the latest ebuild. Happy holidays!