{"action":"created","issue":{"url":"https://api.github.com/repos/IntelRealSense/librealsense/issues/94","repository_url":"https://api.github.com/repos/IntelRealSense/librealsense","labels_url":"https://api.github.com/repos/IntelRealSense/librealsense/issues/94/labels{/name}","comments_url":"https://api.github.com/repos/IntelRealSense/librealsense/issues/94/comments","events_url":"https://api.github.com/repos/IntelRealSense/librealsense/issues/94/events","html_url":"https://github.com/IntelRealSense/librealsense/issues/94","id":145706991,"number":94,"title":"Narrowing conversion in v0.9.1 - Found using clang","user":{"login":"vidstige","id":655605,"avatar_url":"https://avatars.githubusercontent.com/u/655605?v=3","gravatar_id":"","url":"https://api.github.com/users/vidstige","html_url":"https://github.com/vidstige","followers_url":"https://api.github.com/users/vidstige/followers","following_url":"https://api.github.com/users/vidstige/following{/other_user}","gists_url":"https://api.github.com/users/vidstige/gists{/gist_id}","starred_url":"https://api.github.com/users/vidstige/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vidstige/subscriptions","organizations_url":"https://api.github.com/users/vidstige/orgs","repos_url":"https://api.github.com/users/vidstige/repos","events_url":"https://api.github.com/users/vidstige/events{/privacy}","received_events_url":"https://api.github.com/users/vidstige/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-04-04T14:51:02Z","updated_at":"2016-04-04T21:04:10Z","closed_at":null,"body":"Using v0.9.1 I cannot build using clang. I get the following output. It would be great if narrowing conversions where handled more explicitly. It looks like there is no bug in the code at hand, but in general I think it's good to avoid doing to crazy things to keep things working nicely.\r\n\r\n/usr/include/libusb-1.0/libusb.h:732:3: warning: zero size arrays are an extension [-Wzero-length-array]\r\n        [0] /* non-standard, but usually working code */\r\n         ^\r\n/usr/include/libusb-1.0/libusb.h:763:3: warning: zero size arrays are an extension [-Wzero-length-array]\r\n        [0] /* non-standard, but usually working code */\r\n         ^\r\n/usr/include/libusb-1.0/libusb.h:1257:3: warning: zero size arrays are an extension [-Wzero-length-array]\r\n        [0] /* non-standard, but usually working code */\r\n         ^\r\nsrc/uvc-v4l2.cpp:164:43: error: non-constant-expression cannot be narrowed from type 'int' to '__u8'\r\n      (aka 'unsigned char') in initializer list [-Wc++11-narrowing]\r\n                uvc_xu_control_query q = {xu.unit, control, UVC_GET_CUR, static_cast<uint16_t>(size), re...\r\n                                          ^~~~~~~\r\nsrc/uvc-v4l2.cpp:164:43: note: insert an explicit cast to silence this issue\r\n                uvc_xu_control_query q = {xu.unit, control, UVC_GET_CUR, static_cast<uint16_t>(size), re...\r\n                                          ^~~~~~~\r\n                                          static_cast<__u8>( )\r\nsrc/uvc-v4l2.cpp:170:43: error: non-constant-expression cannot be narrowed from type 'int' to '__u8'\r\n      (aka 'unsigned char') in initializer list [-Wc++11-narrowing]\r\n                uvc_xu_control_query q = {xu.unit, control, UVC_SET_CUR, static_cast<uint16_t>(size), re...\r\n                                          ^~~~~~~\r\nsrc/uvc-v4l2.cpp:170:43: note: insert an explicit cast to silence this issue\r\n                uvc_xu_control_query q = {xu.unit, control, UVC_SET_CUR, static_cast<uint16_t>(size), re...\r\n                                          ^~~~~~~\r\n                                          static_cast<__u8>( )\r\n3 warnings and 2 errors generated.\r\nmake: *** [obj/uvc-v4l2.o] Error 1\r\n"},"comment":{"url":"https://api.github.com/repos/IntelRealSense/librealsense/issues/comments/205496811","html_url":"https://github.com/IntelRealSense/librealsense/issues/94#issuecomment-205496811","issue_url":"https://api.github.com/repos/IntelRealSense/librealsense/issues/94","id":205496811,"user":{"login":"sgorsten","id":1824157,"avatar_url":"https://avatars.githubusercontent.com/u/1824157?v=3","gravatar_id":"","url":"https://api.github.com/users/sgorsten","html_url":"https://github.com/sgorsten","followers_url":"https://api.github.com/users/sgorsten/followers","following_url":"https://api.github.com/users/sgorsten/following{/other_user}","gists_url":"https://api.github.com/users/sgorsten/gists{/gist_id}","starred_url":"https://api.github.com/users/sgorsten/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sgorsten/subscriptions","organizations_url":"https://api.github.com/users/sgorsten/orgs","repos_url":"https://api.github.com/users/sgorsten/repos","events_url":"https://api.github.com/users/sgorsten/events{/privacy}","received_events_url":"https://api.github.com/users/sgorsten/received_events","type":"User","site_admin":false},"created_at":"2016-04-04T21:04:10Z","updated_at":"2016-04-04T21:04:10Z","body":"Ah, you've exposed a gap in our testing. We currently only test the V4L2 backend on gcc, the LibUVC backend on clang, and the WMF backend on Visual Studio, which lets stuff like this sneak in sometimes."}}