------- Comment #11 from coleb at eyesopen dot com  2009-05-19 17:57 -------
(In reply to comment #10)
> Look closely at the patch I committed, I changed *nothing* of the actual
> behavior of the containers. Thus the semantics is exactly the same as before,
> only, the destructor in not called explicitly anymore on such element type,
> because the destructor is trivial.
> 

Yup, even though you can declare a vector<float4>, you can't do anything useful
with it. 

typedef float cl_float4[4] __attribute__((aligned(16)));

#include <vector>

int main()
{
  std::vector<cl_float4> vals(1);
  cl_float4 a = {1.0f, 2.0f, 3.0f, 4.0f};
  vals.push_back(a);
}

/usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.1.2/../../../../include/c++/4.1.2/bits/stl_algobase.h:412:
error: ISO C++ forbids assignment of arrays

Does seem strange to allow vector<float4> to be compilable, but eh, lesson
learned, stay away from array types in C++. 


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40192

Reply via email to