{"action":"created","issue":{"url":"https://api.github.com/repos/stan-dev/rstan/issues/506","repository_url":"https://api.github.com/repos/stan-dev/rstan","labels_url":"https://api.github.com/repos/stan-dev/rstan/issues/506/labels{/name}","comments_url":"https://api.github.com/repos/stan-dev/rstan/issues/506/comments","events_url":"https://api.github.com/repos/stan-dev/rstan/issues/506/events","html_url":"https://github.com/stan-dev/rstan/issues/506","id":304995933,"number":506,"title":"Can't C++ compile valid Stan program. \"error: call to 'sqrt' is ambiguous\"","user":{"login":"syclik","id":425751,"avatar_url":"https://avatars2.githubusercontent.com/u/425751?v=4","gravatar_id":"","url":"https://api.github.com/users/syclik","html_url":"https://github.com/syclik","followers_url":"https://api.github.com/users/syclik/followers","following_url":"https://api.github.com/users/syclik/following{/other_user}","gists_url":"https://api.github.com/users/syclik/gists{/gist_id}","starred_url":"https://api.github.com/users/syclik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/syclik/subscriptions","organizations_url":"https://api.github.com/users/syclik/orgs","repos_url":"https://api.github.com/users/syclik/repos","events_url":"https://api.github.com/users/syclik/events{/privacy}","received_events_url":"https://api.github.com/users/syclik/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":{"login":"bob-carpenter","id":3383807,"avatar_url":"https://avatars1.githubusercontent.com/u/3383807?v=4","gravatar_id":"","url":"https://api.github.com/users/bob-carpenter","html_url":"https://github.com/bob-carpenter","followers_url":"https://api.github.com/users/bob-carpenter/followers","following_url":"https://api.github.com/users/bob-carpenter/following{/other_user}","gists_url":"https://api.github.com/users/bob-carpenter/gists{/gist_id}","starred_url":"https://api.github.com/users/bob-carpenter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bob-carpenter/subscriptions","organizations_url":"https://api.github.com/users/bob-carpenter/orgs","repos_url":"https://api.github.com/users/bob-carpenter/repos","events_url":"https://api.github.com/users/bob-carpenter/events{/privacy}","received_events_url":"https://api.github.com/users/bob-carpenter/received_events","type":"User","site_admin":false},"assignees":[{"login":"bob-carpenter","id":3383807,"avatar_url":"https://avatars1.githubusercontent.com/u/3383807?v=4","gravatar_id":"","url":"https://api.github.com/users/bob-carpenter","html_url":"https://github.com/bob-carpenter","followers_url":"https://api.github.com/users/bob-carpenter/followers","following_url":"https://api.github.com/users/bob-carpenter/following{/other_user}","gists_url":"https://api.github.com/users/bob-carpenter/gists{/gist_id}","starred_url":"https://api.github.com/users/bob-carpenter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bob-carpenter/subscriptions","organizations_url":"https://api.github.com/users/bob-carpenter/orgs","repos_url":"https://api.github.com/users/bob-carpenter/repos","events_url":"https://api.github.com/users/bob-carpenter/events{/privacy}","received_events_url":"https://api.github.com/users/bob-carpenter/received_events","type":"User","site_admin":false}],"milestone":null,"comments":19,"created_at":"2018-03-14T01:54:39Z","updated_at":"2018-03-14T17:06:58Z","closed_at":"2018-03-14T07:08:50Z","author_association":"OWNER","body":"#### Summary:\r\nError in compiling a valid Stan program. \r\n\r\nThis was reported as stan-dev/stan#2478. I believe this is an RStan issue, not a Stan issue.\r\n\r\nI had originally thought it was a C++ compiler bug, but I can recreate it on my Mac. It compiles fine with CmdStan.\r\n\r\n\r\n#### Description:\r\nA valid Stan program compiles in CmdStan v2.17.1, but does not compile in RStan 2.17.3.\r\n\r\n\r\n#### Reproducible Steps:\r\n\r\nThis should work, but doesn't compile in RStan. \r\n```stan\r\ntransformed data {\r\n  real one = sqrt(1);\r\n}\r\nparameters {\r\n  real theta;\r\n}\r\nmodel {\r\n  theta ~ normal(0, 1);\r\n}\r\n```\r\n\r\n#### Current Output:\r\n\r\nSome abbreviation for clarity:\r\n\r\n```\r\n> fit <- stan(\"issue.stan\")\r\nIn file included from file83070aa99a6.cpp:8:\r\n...\r\n#  define BOOST_NO_CXX11_RVALUE_REFERENCES\r\n          ^\r\n<command line>:6:9: note: previous definition is here\r\n#define BOOST_NO_CXX11_RVALUE_REFERENCES 1\r\n        ^\r\nfile83070aa99a6.cpp:77:36: error: call to 'sqrt' is ambiguous\r\n            stan::math::assign(one,sqrt(1));\r\n                                   ^~~~\r\n/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/math.h:970:1: note: candidate function [with _A1 = int]\r\nsqrt(_A1 __lcpp_x) _NOEXCEPT {return ::sqrt((double)__lcpp_x);}\r\n^\r\n/Library/Frameworks/R.framework/Versions/3.4/Resources/library/StanHeaders/include/stan/math/prim/mat/fun/sqrt.hpp:32:5: note: candidate function [with T = int]\r\n    sqrt(const T& x) {\r\n    ^\r\n/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/math.h:447:15: note: candidate function\r\nextern double sqrt(double);\r\n              ^\r\n/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/math.h:963:46: note: candidate function\r\ninline _LIBCPP_INLINE_VISIBILITY float       sqrt(float __lcpp_x) _NOEXCEPT       {return ::sqrtf(__lcpp_x);}\r\n                                             ^\r\n/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/math.h:964:46: note: candidate function\r\ninline _LIBCPP_INLINE_VISIBILITY long double sqrt(long double __lcpp_x) _NOEXCEPT {return ::sqrtl(__lcpp_x);}\r\n                                             ^\r\n/Library/Frameworks/R.framework/Versions/3.4/Resources/library/StanHeaders/include/stan/math/rev/scal/fun/sqrt.hpp:50:16: note: candidate function\r\n    inline var sqrt(const var& a) {\r\n               ^\r\n1 warning and 1 error generated.\r\nmake: *** [file83070aa99a6.o] Error 1\r\n\r\nERROR(s) during compilation: source code errors or compiler configuration errors!\r\n\r\nProgram source:\r\n  1: \r\n  2: // includes from the plugin\r\n...\r\n362: // definition\r\n363: \r\n364: SEXP file83070aa99a6(  ){\r\n365:  return Rcpp::wrap(\"issue\");\r\n366: }\r\n367: \r\n368: \r\nError in compileCode(f, code, language = language, verbose = verbose) : \r\n  Compilation ERROR, function(s)/method(s) not created! In file included from file83070aa99a6.cpp:8:\r\n...\r\nIn addition: Warning message:\r\nrunning command '/Library/Frameworks/R.framework/Resources/bin/R CMD SHLIB file83070aa99a6.cpp 2> file83070aa99a6.cpp.err.txt' had status 1 \r\n```\r\n\r\n\r\n#### Expected Output:\r\nNo error.\r\n\r\n#### RStan Version:\r\n```\r\n> packageVersion(\"rstan\")\r\n[1] ‘2.17.3’\r\n```\r\n\r\n#### R Version:\r\n```\r\n> R.version.string\r\n[1] \"R version 3.4.0 (2017-04-21)\"\r\n```\r\n\r\n#### Operating System:\r\nMac OS X 10.13.3\r\n"},"comment":{"url":"https://api.github.com/repos/stan-dev/rstan/issues/comments/373099958","html_url":"https://github.com/stan-dev/rstan/issues/506#issuecomment-373099958","issue_url":"https://api.github.com/repos/stan-dev/rstan/issues/506","id":373099958,"user":{"login":"bob-carpenter","id":3383807,"avatar_url":"https://avatars1.githubusercontent.com/u/3383807?v=4","gravatar_id":"","url":"https://api.github.com/users/bob-carpenter","html_url":"https://github.com/bob-carpenter","followers_url":"https://api.github.com/users/bob-carpenter/followers","following_url":"https://api.github.com/users/bob-carpenter/following{/other_user}","gists_url":"https://api.github.com/users/bob-carpenter/gists{/gist_id}","starred_url":"https://api.github.com/users/bob-carpenter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bob-carpenter/subscriptions","organizations_url":"https://api.github.com/users/bob-carpenter/orgs","repos_url":"https://api.github.com/users/bob-carpenter/repos","events_url":"https://api.github.com/users/bob-carpenter/events{/privacy}","received_events_url":"https://api.github.com/users/bob-carpenter/received_events","type":"User","site_admin":false},"created_at":"2018-03-14T17:06:58Z","updated_at":"2018-03-14T17:06:58Z","author_association":"CONTRIBUTOR","body":"At some point, we just have to stop supporting pre-C++11.  \n\nI don't want to continually have to patch 2.17.x versions as we move forward.\n\n"}}
{"actor":{"display_login":"bob-carpenter"}}