{"action":"created","issue":{"url":"https://api.github.com/repos/boostorg/compute/issues/624","repository_url":"https://api.github.com/repos/boostorg/compute","labels_url":"https://api.github.com/repos/boostorg/compute/issues/624/labels{/name}","comments_url":"https://api.github.com/repos/boostorg/compute/issues/624/comments","events_url":"https://api.github.com/repos/boostorg/compute/issues/624/events","html_url":"https://github.com/boostorg/compute/issues/624","id":163574445,"number":624,"title":"compute::vector<custom_type> and resize","user":{"login":"dPavelDev","id":17548434,"avatar_url":"https://avatars.githubusercontent.com/u/17548434?v=3","gravatar_id":"","url":"https://api.github.com/users/dPavelDev","html_url":"https://github.com/dPavelDev","followers_url":"https://api.github.com/users/dPavelDev/followers","following_url":"https://api.github.com/users/dPavelDev/following{/other_user}","gists_url":"https://api.github.com/users/dPavelDev/gists{/gist_id}","starred_url":"https://api.github.com/users/dPavelDev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dPavelDev/subscriptions","organizations_url":"https://api.github.com/users/dPavelDev/orgs","repos_url":"https://api.github.com/users/dPavelDev/repos","events_url":"https://api.github.com/users/dPavelDev/events{/privacy}","received_events_url":"https://api.github.com/users/dPavelDev/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2016-07-03T18:50:52Z","updated_at":"2016-07-03T20:51:27Z","closed_at":null,"body":"When I want to create vector with custom type and resize it, I get compilation error:\r\n\r\n> C:\\boost_gcc\\include\\boost-1_61/boost/compute/type_traits/type_name.hpp:98:46: error: incomplete type 'boost::compute::detail::type_name_trait<custom_type>' used in nested name specifier\r\n>      return detail::type_name_trait<T>::value();\r\n\r\nCode example:\r\n```cpp\r\n#include <boost/compute.hpp>\r\n\r\nusing namespace std;\r\n\r\nstruct custom_type {\r\n    boost::compute::int_ someInt;\r\n    boost::compute::float2_ somePoint;\r\n};\r\n\r\nint main() {\r\n    boost::compute::vector<custom_type> v;\r\n    v.resize(10);\r\n\r\n    return 0;\r\n}\r\n\r\n```\r\n\r\nPlease, fix it.\r\n\r\n<bountysource-plugin>\r\n---\r\nWant to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/35712470-compute-vector-custom_type-and-resize?utm_campaign=plugin&utm_content=tracker%2F402515&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F402515&utm_medium=issues&utm_source=github).\r\n</bountysource-plugin>"},"comment":{"url":"https://api.github.com/repos/boostorg/compute/issues/comments/230174649","html_url":"https://github.com/boostorg/compute/issues/624#issuecomment-230174649","issue_url":"https://api.github.com/repos/boostorg/compute/issues/624","id":230174649,"user":{"login":"dPavelDev","id":17548434,"avatar_url":"https://avatars.githubusercontent.com/u/17548434?v=3","gravatar_id":"","url":"https://api.github.com/users/dPavelDev","html_url":"https://github.com/dPavelDev","followers_url":"https://api.github.com/users/dPavelDev/followers","following_url":"https://api.github.com/users/dPavelDev/following{/other_user}","gists_url":"https://api.github.com/users/dPavelDev/gists{/gist_id}","starred_url":"https://api.github.com/users/dPavelDev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dPavelDev/subscriptions","organizations_url":"https://api.github.com/users/dPavelDev/orgs","repos_url":"https://api.github.com/users/dPavelDev/repos","events_url":"https://api.github.com/users/dPavelDev/events{/privacy}","received_events_url":"https://api.github.com/users/dPavelDev/received_events","type":"User","site_admin":false},"created_at":"2016-07-03T20:51:27Z","updated_at":"2016-07-03T20:51:27Z","body":"I'm using cl_float* unions in my project because custom structures with this types **have same aligment and sizeof()** that in OpenCL kernel (on GNU GCC Compiler). It is important.\r\n\r\nBut cl_float2 is aligment union and I don't use it in custom structure under this library:\r\nerror: static assertion failed: BOOST_COMPUTE_ADAPT_STRUCT() does not support structs with internal padding\r\n\r\ncode:\r\n```cpp\r\n#include <boost/compute.hpp>\r\n\r\nusing namespace std;\r\n\r\nstruct custom_type {\r\n    boost::compute::int_ someInt;\r\n    boost::compute::float2_ somePoint;\r\n};\r\n\r\nstruct same_custom_type {\r\n    int someInt;\r\n    cl_float2 somePoint;\r\n};\r\n\r\nBOOST_COMPUTE_ADAPT_STRUCT(cl_float2, float2, (s));\r\nBOOST_COMPUTE_ADAPT_STRUCT(same_custom_type, same_custom_type, (someInt, somePoint));\r\n\r\nint main() {\r\n    cout << sizeof(custom_type) << \" \" << sizeof(same_custom_type) << endl; // ! different sizeof under GCC\r\n\r\n    boost::compute::vector<same_custom_type> v;\r\n    v.resize(10);\r\n\r\n    return 0;\r\n}\r\n\r\n```\r\n\r\nAnd I have a question: Should I pay attension to  identical size on the custom structures  on the host and in the kernel using this library ?"}}
{"actor":{"display_login":"dPavelDev"}}