{"action":"created","issue":{"url":"https://api.github.com/repos/duckie/named_types/issues/2","repository_url":"https://api.github.com/repos/duckie/named_types","labels_url":"https://api.github.com/repos/duckie/named_types/issues/2/labels{/name}","comments_url":"https://api.github.com/repos/duckie/named_types/issues/2/comments","events_url":"https://api.github.com/repos/duckie/named_types/issues/2/events","html_url":"https://github.com/duckie/named_types/pull/2","id":273850723,"number":2,"title":"Patch for std::get<>() problem with Windows LLVM clang ","user":{"login":"lovemycatt","id":15888712,"avatar_url":"https://avatars3.githubusercontent.com/u/15888712?v=4","gravatar_id":"","url":"https://api.github.com/users/lovemycatt","html_url":"https://github.com/lovemycatt","followers_url":"https://api.github.com/users/lovemycatt/followers","following_url":"https://api.github.com/users/lovemycatt/following{/other_user}","gists_url":"https://api.github.com/users/lovemycatt/gists{/gist_id}","starred_url":"https://api.github.com/users/lovemycatt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lovemycatt/subscriptions","organizations_url":"https://api.github.com/users/lovemycatt/orgs","repos_url":"https://api.github.com/users/lovemycatt/repos","events_url":"https://api.github.com/users/lovemycatt/events{/privacy}","received_events_url":"https://api.github.com/users/lovemycatt/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2017-11-14T16:13:51Z","updated_at":"2017-11-15T09:12:36Z","closed_at":null,"author_association":"NONE","pull_request":{"url":"https://api.github.com/repos/duckie/named_types/pulls/2","html_url":"https://github.com/duckie/named_types/pull/2","diff_url":"https://github.com/duckie/named_types/pull/2.diff","patch_url":"https://github.com/duckie/named_types/pull/2.patch"},"body":"These patches are required in order to build on Windows with LLVM clang 5.0 toolset (either with mingw or with MSVC using LLVM-vs2014 toolset).\r\n\r\nBasically, the encountered problem is that, under certain (many) conditions, `std::get<>()` is not able to cast a `named_tuple<>` or a `tagged_tuple<>` to its base `std::tuple<>`. \r\nThis is the case, for instance, of the `named_tuple::operator[]`.\r\n\r\nI believe this is a bug of the Windows version of LLVM clang distribution, anyways the patched code introduces no overhead and is quite simple.\r\n\r\nThe proposed solution implements to patches:\r\n- an explicitly cast to the base `std::tuple<>` in `std::get<>()` calls in `tagged.hpp` (a simple solution, yet nor general as other client code may use `std::get<>()` on a` tagged_tuple<>`);\r\n- ovverridden `std::get<>()` functions for `named_tuple<>` in `named_tuple.hpp` (a bit longer solution, but more general, also fixes al client code that uses `std::get<>()` on `named_tuple<>` and, as far as I have seen, on any other derived classes).\r\n\r\nI'd be curious to know your opinion on this strange LLVM 'bug', and if you can imagine better solutions (other than working on Linux :)).\r\n\r\nFollows a sample error log:\r\n\r\n```\r\n  In file included from D:\\Users\\Tulmenga\\Projects\\prj_0lf\\factory_0lf\\0lf\\0lf/internal/logger_def_dumpers.hh:23:\r\n1>D:\\Users\\Tulmenga\\Projects\\prj_0lf\\factory_0lf\\0lf\\..\\named_types\\includes\\named_types/named_tuple.hpp(170,12): error : no matching function for call to 'get'\r\n1>      return std::get<\r\n1>             ^~~~~~~~~\r\n1>  D:\\Users\\Tulmenga\\Projects\\prj_0lf\\factory_0lf\\0lf\\src\\process_monitor.cpp(132,23):  note: in instantiation of function template specialization 'named_types::named_tuple<unsigned long long (named_types::named_tag<named_types::string_literal<char, 'a', 'c', 't', 'o', 'r', 's'> >), double (named_types::named_tag<named_types::string_literal<char, 'm', 'o', 'd', '_', 'c', 'p', 'u'> >), double (named_types::named_tag<named_types::string_literal<char, 's', 'y', 's', '_', 'c', 'p', 'u'> >), unsigned long long (named_types::named_tag<named_types::string_literal<char, 'm', 'o', 'd', '_', 'r', 'a', 'm'> >), std::basic_string<char, std::char_traits<char>, std::allocator<char> > (named_types::named_tag<named_types::string_literal<char, 't', 'r', 'a', 'c', 'e', '_', 'm', 'o', 'd', 'e'> >), unsigned long long (named_types::named_tag<named_types::string_literal<char, 's', 'y', 's', '_', 'f', 'r', 'e', 'e', '_', 'r', 'a', 'm'> >)>::operator[]<named_types::string_literal<char, 'a', 'c', 't', 'o', 'r', 's'> >' requested here\r\n1>                  info_ [_(actors)] = home_system().registry().running();\r\n1>                        ^\r\n1>  C:\\apps\\MSStudio2015\\VC\\include\\utility(518,3):  note: candidate template ignored: could not match 'pair' against 'named_tuple'\r\n1>                  get(pair<_Ty1, _Ty2>& _Pr) _NOEXCEPT\r\n1>                  ^\r\n1>  C:\\apps\\MSStudio2015\\VC\\include\\utility(542,3):  note: candidate template ignored: could not match 'pair' against 'named_tuple'\r\n1>                  get(const pair<_Ty1, _Ty2>& _Pr) _NOEXCEPT\r\n1>                  ^\r\n1>  C:\\apps\\MSStudio2015\\VC\\include\\utility(567,3):  note: candidate template ignored: could not match 'pair' against 'named_tuple'\r\n1>                  get(pair<_Ty1, _Ty2>&& _Pr) _NOEXCEPT\r\n1>                  ^\r\n1>  C:\\apps\\MSStudio2015\\VC\\include\\tuple(882,3):  note: candidate template ignored: failed template argument deduction\r\n1>                  get(tuple<_Types...>& _Tuple) _NOEXCEPT\r\n1>                  ^\r\n1>  C:\\apps\\MSStudio2015\\VC\\include\\tuple(892,3):  note: candidate template ignored: failed template argument deduction\r\n1>                  get(const tuple<_Types...>& _Tuple) _NOEXCEPT\r\n1>                  ^\r\n1>  C:\\apps\\MSStudio2015\\VC\\include\\tuple(902,3):  note: candidate template ignored: failed template argument deduction\r\n1>                  get(tuple<_Types...>&& _Tuple) _NOEXCEPT\r\n1>                  ^\r\n1>  C:\\apps\\MSStudio2015\\VC\\include\\array(493,17):  note: candidate template ignored: could not match 'array' against 'named_tuple'\r\n1>          constexpr _Ty& get(array<_Ty, _Size>& _Arr) _NOEXCEPT\r\n1>                         ^\r\n1>  C:\\apps\\MSStudio2015\\VC\\include\\array(502,23):  note: candidate template ignored: could not match 'array' against 'named_tuple'\r\n1>          constexpr const _Ty& get(const array<_Ty, _Size>& _Arr) _NOEXCEPT\r\n1>                               ^\r\n1>  C:\\apps\\MSStudio2015\\VC\\include\\array(511,18):  note: candidate template ignored: could not match 'array' against 'named_tuple'\r\n1>          constexpr _Ty&& get(array<_Ty, _Size>&& _Arr) _NOEXCEPT\r\n1>                          ^\r\n1>  C:\\apps\\MSStudio2015\\VC\\include\\utility(526,18):  note: candidate template ignored: invalid explicitly-specified argument for template parameter '_Ty1'\r\n1>          constexpr _Ty1& get(pair<_Ty1, _Ty2>& _Pr) _NOEXCEPT\r\n1>                          ^\r\n1>  C:\\apps\\MSStudio2015\\VC\\include\\utility(533,18):  note: candidate template ignored: invalid explicitly-specified argument for template parameter '_Ty2'\r\n1>          constexpr _Ty2& get(pair<_Ty1, _Ty2>& _Pr) _NOEXCEPT\r\n1>                          ^\r\n1>  C:\\apps\\MSStudio2015\\VC\\include\\utility(551,24):  note: candidate template ignored: invalid explicitly-specified argument for template parameter '_Ty1'\r\n1>          constexpr const _Ty1& get(const pair<_Ty1, _Ty2>& _Pr) _NOEXCEPT\r\n1>                                ^\r\n1>  C:\\apps\\MSStudio2015\\VC\\include\\utility(558,24):  note: candidate template ignored: invalid explicitly-specified argument for template parameter '_Ty2'\r\n1>          constexpr const _Ty2& get(const pair<_Ty1, _Ty2>& _Pr) _NOEXCEPT\r\n1>                                ^\r\n1>  C:\\apps\\MSStudio2015\\VC\\include\\utility(575,19):  note: candidate template ignored: invalid explicitly-specified argument for template parameter '_Ty1'\r\n1>          constexpr _Ty1&& get(pair<_Ty1, _Ty2>&& _Pr) _NOEXCEPT\r\n1>                           ^\r\n1>  C:\\apps\\MSStudio2015\\VC\\include\\utility(582,19):  note: candidate template ignored: invalid explicitly-specified argument for template parameter '_Ty2'\r\n1>          constexpr _Ty2&& get(pair<_Ty1, _Ty2>&& _Pr) _NOEXCEPT\r\n1>                           ^\r\n1>  C:\\apps\\MSStudio2015\\VC\\include\\tuple(914,17):  note: candidate template ignored: invalid explicitly-specified argument for template parameter '_Ty'\r\n1>          constexpr _Ty& get(tuple<_Types...>& _Tuple) _NOEXCEPT\r\n1>                         ^\r\n1>  C:\\apps\\MSStudio2015\\VC\\include\\tuple(922,23):  note: candidate template ignored: invalid explicitly-specified argument for template parameter '_Ty'\r\n1>          constexpr const _Ty& get(const tuple<_Types...>& _Tuple) _NOEXCEPT\r\n1>                               ^\r\n1>  C:\\apps\\MSStudio2015\\VC\\include\\tuple(930,18):  note: candidate template ignored: invalid explicitly-specified argument for template parameter '_Ty'\r\n1>          constexpr _Ty&& get(tuple<_Types...>&& _Tuple) _NOEXCEPT\r\n1>                          ^\r\n1>  D:\\Users\\Tulmenga\\Projects\\prj_0lf\\factory_0lf\\0lf\\..\\named_types\\includes\\std/experimental/tagged.hpp(233,1):  note: candidate template ignored: invalid explicitly-specified argument for template parameter 'Tag'\r\n1>  get(tagged_tuple<Types...> const& input) {\r\n1>  ^\r\n1>  D:\\Users\\Tulmenga\\Projects\\prj_0lf\\factory_0lf\\0lf\\..\\named_types\\includes\\std/experimental/tagged.hpp(239,1):  note: candidate template ignored: invalid explicitly-specified argument for template parameter 'Tag'\r\n1>  get(tagged_tuple<Types...>& input) {\r\n1>  ^\r\n1>  D:\\Users\\Tulmenga\\Projects\\prj_0lf\\factory_0lf\\0lf\\..\\named_types\\includes\\std/experimental/tagged.hpp(245,1):  note: candidate template ignored: invalid explicitly-specified argument for template parameter 'Tag'\r\n1>  get(tagged_tuple<Types...>&& input) {\r\n1>  ^\r\n\r\n```"},"comment":{"url":"https://api.github.com/repos/duckie/named_types/issues/comments/344531013","html_url":"https://github.com/duckie/named_types/pull/2#issuecomment-344531013","issue_url":"https://api.github.com/repos/duckie/named_types/issues/2","id":344531013,"user":{"login":"lovemycatt","id":15888712,"avatar_url":"https://avatars3.githubusercontent.com/u/15888712?v=4","gravatar_id":"","url":"https://api.github.com/users/lovemycatt","html_url":"https://github.com/lovemycatt","followers_url":"https://api.github.com/users/lovemycatt/followers","following_url":"https://api.github.com/users/lovemycatt/following{/other_user}","gists_url":"https://api.github.com/users/lovemycatt/gists{/gist_id}","starred_url":"https://api.github.com/users/lovemycatt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lovemycatt/subscriptions","organizations_url":"https://api.github.com/users/lovemycatt/orgs","repos_url":"https://api.github.com/users/lovemycatt/repos","events_url":"https://api.github.com/users/lovemycatt/events{/privacy}","received_events_url":"https://api.github.com/users/lovemycatt/received_events","type":"User","site_admin":false},"created_at":"2017-11-15T09:12:36Z","updated_at":"2017-11-15T09:12:36Z","author_association":"NONE","body":"Thanks for taking it into consideration.\r\nIf you need some further tests on Windows (VS2015, v140_clang_c2, LLVM, Mingw), just tell me.\r\n"}}
{"actor":{"display_login":"lovemycatt"}}