{"action":"created","issue":{"url":"https://api.github.com/repos/facebook/proxygen/issues/140","repository_url":"https://api.github.com/repos/facebook/proxygen","labels_url":"https://api.github.com/repos/facebook/proxygen/issues/140/labels{/name}","comments_url":"https://api.github.com/repos/facebook/proxygen/issues/140/comments","events_url":"https://api.github.com/repos/facebook/proxygen/issues/140/events","html_url":"https://github.com/facebook/proxygen/pull/140","id":197276214,"number":140,"title":"sfinae expressions generate wrong definitions","user":{"login":"skypjack","id":1812216,"avatar_url":"https://avatars.githubusercontent.com/u/1812216?v=3","gravatar_id":"","url":"https://api.github.com/users/skypjack","html_url":"https://github.com/skypjack","followers_url":"https://api.github.com/users/skypjack/followers","following_url":"https://api.github.com/users/skypjack/following{/other_user}","gists_url":"https://api.github.com/users/skypjack/gists{/gist_id}","starred_url":"https://api.github.com/users/skypjack/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/skypjack/subscriptions","organizations_url":"https://api.github.com/users/skypjack/orgs","repos_url":"https://api.github.com/users/skypjack/repos","events_url":"https://api.github.com/users/skypjack/events{/privacy}","received_events_url":"https://api.github.com/users/skypjack/received_events","type":"User","site_admin":false},"labels":[{"id":196858260,"url":"https://api.github.com/repos/facebook/proxygen/labels/CLA%20Signed","name":"CLA Signed","color":"009900","default":false},{"id":308789617,"url":"https://api.github.com/repos/facebook/proxygen/labels/GH%20Review:%20review-needed","name":"GH Review: review-needed","color":"fbca04","default":false},{"id":505795151,"url":"https://api.github.com/repos/facebook/proxygen/labels/Import%20Started","name":"Import Started","color":"ededed","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-12-22T22:04:38Z","updated_at":"2016-12-23T01:35:39Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/facebook/proxygen/pulls/140","html_url":"https://github.com/facebook/proxygen/pull/140","diff_url":"https://github.com/facebook/proxygen/pull/140.diff","patch_url":"https://github.com/facebook/proxygen/pull/140.patch"},"body":"Sfinae expressions don't work properly and generate wrong definitions for the two functions.\r\nWe can further reduce the case to the following example:\r\n\r\n    #include <type_traits>\r\n    #include <utility>\r\n\r\n    struct S {\r\n        template<typename T>\r\n        std::enable_if<std::is_constructible<T>::value>\r\n        f() {}\r\n    };\r\n\r\n    int main() {\r\n        static_assert(std::is_same<decltype(std::declval<S>().f<void>()), std::enable_if<false>>::value, \"!\");\r\n        static_assert(std::is_same<decltype(std::declval<S>().f<int>()), std::enable_if<true>>::value, \"!\");\r\n    }\r\n\r\nAs shown:\r\n\r\n* In the first case, the function should be rejected during substitution. Instead it is accepted with a return type `std:.enable_if<false>`.\r\n* In the second case, the expected type is probably `void`, the actual one is `std::enable_if<true>`.\r\n\r\nSomething similar happens to `FilterChain::addFilters` function templates.\r\n\r\n---\r\n\r\nI've used the same _C++11-ish_ expressions seen in the whole codebase:\r\n\r\n    typename std::enable_if<std::is_constructible<C>::value>::type\r\n\r\nNote that it could be replaced by the following one (admitted that the actual revision of the standard required by Proxygen is C++14):\r\n\r\n    std::enable_if_t<std::is_constructible<C>::value>"},"comment":{"url":"https://api.github.com/repos/facebook/proxygen/issues/comments/268926740","html_url":"https://github.com/facebook/proxygen/pull/140#issuecomment-268926740","issue_url":"https://api.github.com/repos/facebook/proxygen/issues/140","id":268926740,"user":{"login":"maxgeorg","id":12866452,"avatar_url":"https://avatars.githubusercontent.com/u/12866452?v=3","gravatar_id":"","url":"https://api.github.com/users/maxgeorg","html_url":"https://github.com/maxgeorg","followers_url":"https://api.github.com/users/maxgeorg/followers","following_url":"https://api.github.com/users/maxgeorg/following{/other_user}","gists_url":"https://api.github.com/users/maxgeorg/gists{/gist_id}","starred_url":"https://api.github.com/users/maxgeorg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maxgeorg/subscriptions","organizations_url":"https://api.github.com/users/maxgeorg/orgs","repos_url":"https://api.github.com/users/maxgeorg/repos","events_url":"https://api.github.com/users/maxgeorg/events{/privacy}","received_events_url":"https://api.github.com/users/maxgeorg/received_events","type":"User","site_admin":false},"created_at":"2016-12-23T01:35:39Z","updated_at":"2016-12-23T01:35:39Z","body":"Thank you for the PR! Syntactically what you're saying makes perfect sense. I will build and test it. I also wonder if not rejecting the instantiation of these two methods can cause any troubles, like build breaks for certain filter definitions. Will try to reproduce such situation."}}
{"actor":{"display_login":"maxgeorg"}}