{"action":"opened","issue":{"url":"https://api.github.com/repos/stan-dev/stan/issues/1909","repository_url":"https://api.github.com/repos/stan-dev/stan","labels_url":"https://api.github.com/repos/stan-dev/stan/issues/1909/labels{/name}","comments_url":"https://api.github.com/repos/stan-dev/stan/issues/1909/comments","events_url":"https://api.github.com/repos/stan-dev/stan/issues/1909/events","html_url":"https://github.com/stan-dev/stan/issues/1909","id":159673504,"number":1909,"title":"vector[0] data declaration causes Eigen constructor ambiguity","user":{"login":"bob-carpenter","id":3383807,"avatar_url":"https://avatars.githubusercontent.com/u/3383807?v=3","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},"labels":[{"url":"https://api.github.com/repos/stan-dev/stan/labels/Bug","name":"Bug","color":"e11d21"}],"state":"open","locked":false,"assignee":{"login":"bob-carpenter","id":3383807,"avatar_url":"https://avatars.githubusercontent.com/u/3383807?v=3","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":{"url":"https://api.github.com/repos/stan-dev/stan/milestones/19","html_url":"https://github.com/stan-dev/stan/milestones/v2.10.0","labels_url":"https://api.github.com/repos/stan-dev/stan/milestones/19/labels","id":1437786,"number":19,"title":"v2.10.0","description":"Next version after v2.9.0.","creator":{"login":"syclik","id":425751,"avatar_url":"https://avatars.githubusercontent.com/u/425751?v=3","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},"open_issues":3,"closed_issues":103,"state":"open","created_at":"2015-12-01T16:06:42Z","updated_at":"2016-06-10T16:30:03Z","due_on":null,"closed_at":null},"comments":0,"created_at":"2016-06-10T16:30:03Z","updated_at":"2016-06-10T16:30:03Z","closed_at":null,"body":"#### Summary:\r\n\r\nData variable declarations of type/size `vector[0]` will not compile.\r\n\r\n#### Description:\r\n\r\nBecause of how integer literals are cast in C++, there is an ambiguity in calling `Eigen::VectorXd(0)` between the index and pointer constructors.\r\n\r\n#### Reproducible Steps:\r\n\r\nProvided by Charles Driver, who originally reported the bug on stan-users:\r\n\r\n```\r\nparameters {\r\n  vector[0] test;\r\n}\r\nmodel {\r\n  test~normal(0,1);\r\n}\r\n```\r\n\r\n\r\n\r\n#### Current Output:\r\n\r\nAttempting to compile the generated code produces an ambiguity in construtors:\r\n\r\n```\r\ncall to constructor of 'vector_d' (aka 'Matrix<double, Eigen::Dynamic, 1>') is ambiguous\r\n        vector_d test(0);\r\n                 ^    ~\r\n\r\nEigen/src/Core/Matrix.h:235:34: note: candidate constructor\r\n    EIGEN_STRONG_INLINE explicit Matrix(Index dim)\r\n                                 ^\r\nEigen/src/Core/Matrix.h:283:14: note: candidate constructor\r\n    explicit Matrix(const Scalar *data);\r\n```\r\n\r\n#### Expected Output:\r\n\r\nIt should compile treating `0` as an index\r\n\r\n#### Current Version:\r\nv2.9.0\r\n"}}
{"actor":{"display_login":"bob-carpenter"}}