[macstl-dev] gcc 3.3 on YellowDogLinux
Michael LeBlanc
leblanc at skycomputers.com
Fri Mar 25 20:51:45 WST 2005
On Mar 24, 2005, at 7:47 PM, Glen Low wrote:
> Try declaring the typedefs outside of a class. I sometimes find gcc is
> a little silly about its C extensions scoped within a C++ class (e.g.
> I tried the no_alias attribute but it caused ICE's and other
> unpleasantness if used in a typedef scoped within a C++ class). Try
> within a namespace (stdext::impl) first, and if that fails, declare
> them at global scope.
Silly is right! I'll try inside namespaces shortly. About the cast,
is the intent just to change type? You don't want any code generated,
do you?
~/valarray]$ cat -n y.cpp
1 #include <altivec.h>
2
3 #ifdef USE_TYPEDEF
4 typedef __vector unsigned int VUT;
5 #endif
6
7 template <unsigned int v0> struct generator
8 {
9 #ifdef USE_TYPEDEF
10 VUT
11 #else
12 __vector unsigned int
13 #endif
14 operator() () const
15 {
16 union union_type
17 {
18 unsigned int val [4];
19 __vector unsigned int vec;
20 };
21 static const union_type un = {v0, v0, v0, v0};
22 return un.vec;
23 }
24 };
25
26 __vector unsigned char zz =
27 static_cast <__vector unsigned char>
28 (generator <0> () ())
29 ;
30
$ gcc -c y.cpp -DUSE_TYPEDEF
y.cpp:28: error: invalid static_cast from type `vector unsigned int' to
type `
vector unsigned char'
More information about the macstl-dev
mailing list