[cfe-dev] vector constructors

Chris Lattner clattner at apple.com
Wed Mar 17 09:21:12 PDT 2010


Looks right to me!

-Chris

On Mar 17, 2010, at 9:08 AM, Jochen Wilhelmy <j.wilhelmy at arcor.de>  
wrote:

> Hi!
>
> just to capture the current state of c++ style vector support I made a
> little test:
>
> struct Foo
> {
>     Foo(int) : x() {} // works
>     Foo(float f) : x(f) {} // works
>     Foo(float4 x) : x(x) {} // works
>     Foo() : x(1, 2, 3, 4) {} // error: excess elements in scalar
> initializer
>
>     float4 bar1() {return float4();} // works
>     float4 bar2() {return float4(f);} // works
>     float4 bar3() {return float4(x);} // works
>     float4 bar4() {return float4(1, 2, 3, 4);} // error: function- 
> style
> cast to a builtin type can only take one argument
>
>     float f;
>     float4 x;
> };
>
> I only checked if the statements compile.
>
> -Jochen
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev



More information about the cfe-dev mailing list