{"action":"opened","issue":{"url":"https://api.github.com/repos/codeplaysoftware/computecpp-sdk/issues/95","repository_url":"https://api.github.com/repos/codeplaysoftware/computecpp-sdk","labels_url":"https://api.github.com/repos/codeplaysoftware/computecpp-sdk/issues/95/labels{/name}","comments_url":"https://api.github.com/repos/codeplaysoftware/computecpp-sdk/issues/95/comments","events_url":"https://api.github.com/repos/codeplaysoftware/computecpp-sdk/issues/95/events","html_url":"https://github.com/codeplaysoftware/computecpp-sdk/issues/95","id":301120016,"number":95,"title":"constexpr problems with MSVC","user":{"login":"ProGTX","id":4526787,"avatar_url":"https://avatars3.githubusercontent.com/u/4526787?v=4","gravatar_id":"","url":"https://api.github.com/users/ProGTX","html_url":"https://github.com/ProGTX","followers_url":"https://api.github.com/users/ProGTX/followers","following_url":"https://api.github.com/users/ProGTX/following{/other_user}","gists_url":"https://api.github.com/users/ProGTX/gists{/gist_id}","starred_url":"https://api.github.com/users/ProGTX/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ProGTX/subscriptions","organizations_url":"https://api.github.com/users/ProGTX/orgs","repos_url":"https://api.github.com/users/ProGTX/repos","events_url":"https://api.github.com/users/ProGTX/events{/privacy}","received_events_url":"https://api.github.com/users/ProGTX/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-02-28T17:48:11Z","updated_at":"2018-02-28T17:48:11Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"I've noticed that the Gaussian blur sample fails to compile with Visual Studio 2015 using ComputeCpp 0.6:\r\n```\r\ngaussian-blur.cpp(159): error C2131: expression did not evaluate to a constant\r\ngaussian-blur.cpp(159): note: failure was caused by non-constant arguments or reference to a non-constant symbol\r\n```\r\nThis is referring to this line of the `GaussianKernel` kernel lambda:\r\n```\r\nconstexpr auto offset = 3 * stddev;\r\n```\r\nEven though `stddev` is a `constexpr` variable that was declared outside the kernel lambda, it's not considered `constexpr` inside the kernel lambda.\r\n\r\nI believe this is a [Visual Studio bug](https://developercommunity.visualstudio.com/content/problem/93922/constexprs-are-trying-to-be-captured-in-lambda-fun.html) that's not even been fixed in MSVC 2017 (https://godbolt.org/g/t7n1uW).\r\n\r\nInterestingly, it seems that making the `constexpr` variable `static constexpr` solves this problem, so maybe this should be the default way of using `constexpr` variables inside kernels."}}
{"actor":{"display_login":"ProGTX"}}