{"action":"created","issue":{"url":"https://api.github.com/repos/nlohmann/json/issues/68","labels_url":"https://api.github.com/repos/nlohmann/json/issues/68/labels{/name}","comments_url":"https://api.github.com/repos/nlohmann/json/issues/68/comments","events_url":"https://api.github.com/repos/nlohmann/json/issues/68/events","html_url":"https://github.com/nlohmann/json/issues/68","id":72853213,"number":68,"title":"errors in g++-4.8.1","user":{"login":"soonhokong","id":403281,"avatar_url":"https://avatars.githubusercontent.com/u/403281?v=3","gravatar_id":"","url":"https://api.github.com/users/soonhokong","html_url":"https://github.com/soonhokong","followers_url":"https://api.github.com/users/soonhokong/followers","following_url":"https://api.github.com/users/soonhokong/following{/other_user}","gists_url":"https://api.github.com/users/soonhokong/gists{/gist_id}","starred_url":"https://api.github.com/users/soonhokong/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/soonhokong/subscriptions","organizations_url":"https://api.github.com/users/soonhokong/orgs","repos_url":"https://api.github.com/users/soonhokong/repos","events_url":"https://api.github.com/users/soonhokong/events{/privacy}","received_events_url":"https://api.github.com/users/soonhokong/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/nlohmann/json/labels/bug","name":"bug","color":"fc2929"}],"state":"open","locked":false,"assignee":{"login":"nlohmann","id":159488,"avatar_url":"https://avatars.githubusercontent.com/u/159488?v=3","gravatar_id":"","url":"https://api.github.com/users/nlohmann","html_url":"https://github.com/nlohmann","followers_url":"https://api.github.com/users/nlohmann/followers","following_url":"https://api.github.com/users/nlohmann/following{/other_user}","gists_url":"https://api.github.com/users/nlohmann/gists{/gist_id}","starred_url":"https://api.github.com/users/nlohmann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nlohmann/subscriptions","organizations_url":"https://api.github.com/users/nlohmann/orgs","repos_url":"https://api.github.com/users/nlohmann/repos","events_url":"https://api.github.com/users/nlohmann/events{/privacy}","received_events_url":"https://api.github.com/users/nlohmann/received_events","type":"User","site_admin":false},"milestone":null,"comments":3,"created_at":"2015-05-03T19:29:35Z","updated_at":"2015-05-06T17:55:53Z","closed_at":null,"body":"g++-4.8.1 generates the following two errors while g++-4.9.2 does not generate any error (OS: ubuntu-12.04).\r\n\r\n```\r\ng++-4.8 -std=c++11    -I src -I test test/unit.cpp  -o json_unit\r\nIn file included from test/unit.cpp:25:0:\r\nsrc/json.hpp: In instantiation of ‘T nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberFloatType, AllocatorType>::erase(T) [with T = nlohmann::basic_json<>::const_iterator; typename std::enable_if<(std::is_same<V, nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberFloatType, AllocatorType>::iterator>::value || std::is_same<V, nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberFloatType, AllocatorType>::const_iterator>::value), int>::type <anonymous> = 0; ObjectType = std::map; ArrayType = std::vector; StringType = std::basic_string<char>; BooleanType = bool; NumberIntegerType = long int; NumberFloatType = double; AllocatorType = std::allocator]’:\r\ntest/unit.cpp:2655:80:   required from here\r\nsrc/json.hpp:1286:44: error: no matching function for call to ‘std::vector<nlohmann::basic_json<> >::erase(__gnu_cxx::__normal_iterator<const nlohmann::basic_json<>*, std::vector<nlohmann::basic_json<> > >&)’\r\n                 result.m_it.array_iterator = m_value.array->erase(pos.m_it.array_iterator);\r\n                                            ^\r\nsrc/json.hpp:1286:44: note: candidates are:\r\nIn file included from /usr/include/c++/4.8/vector:69:0,\r\n                 from /usr/include/c++/4.8/bits/random.h:34,\r\n                 from /usr/include/c++/4.8/random:50,\r\n                 from /usr/include/c++/4.8/bits/stl_algo.h:65,\r\n                 from /usr/include/c++/4.8/algorithm:62,\r\n                 from test/catch.hpp:62,\r\n                 from test/unit.cpp:11:\r\n/usr/include/c++/4.8/bits/vector.tcc:134:5: note: std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::erase(std::vector<_Tp, _Alloc>::iterator) [with _Tp = nlohmann::basic_json<>; _Alloc = std::allocator<nlohmann::basic_json<> >; std::vector<_Tp, _Alloc>::iterator = __gnu_cxx::__normal_iterator<nlohmann::basic_json<>*, std::vector<nlohmann::basic_json<> > >; typename std::_Vector_base<_Tp, _Alloc>::pointer = nlohmann::basic_json<>*]\r\n     vector<_Tp, _Alloc>::\r\n     ^\r\n/usr/include/c++/4.8/bits/vector.tcc:134:5: note:   no known conversion for argument 1 from ‘__gnu_cxx::__normal_iterator<const nlohmann::basic_json<>*, std::vector<nlohmann::basic_json<> > >’ to ‘std::vector<nlohmann::basic_json<> >::iterator {aka __gnu_cxx::__normal_iterator<nlohmann::basic_json<>*, std::vector<nlohmann::basic_json<> > >}’\r\n/usr/include/c++/4.8/bits/vector.tcc:146:5: note: std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::erase(std::vector<_Tp, _Alloc>::iterator, std::vector<_Tp, _Alloc>::iterator) [with _Tp = nlohmann::basic_json<>; _Alloc = std::allocator<nlohmann::basic_json<> >; std::vector<_Tp, _Alloc>::iterator = __gnu_cxx::__normal_iterator<nlohmann::basic_json<>*, std::vector<nlohmann::basic_json<> > >; typename std::_Vector_base<_Tp, _Alloc>::pointer = nlohmann::basic_json<>*]\r\n     vector<_Tp, _Alloc>::\r\n     ^\r\n/usr/include/c++/4.8/bits/vector.tcc:146:5: note:   candidate expects 2 arguments, 1 provided\r\nIn file included from test/unit.cpp:25:0:\r\nsrc/json.hpp: In instantiation of ‘T nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberFloatType, AllocatorType>::erase(T, T) [with T = nlohmann::basic_json<>::const_iterator; typename std::enable_if<(std::is_same<V, nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberFloatType, AllocatorType>::iterator>::value || std::is_same<V, nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberFloatType, AllocatorType>::const_iterator>::value), int>::type <anonymous> = 0; ObjectType = std::map; ArrayType = std::vector; StringType = std::basic_string<char>; BooleanType = bool; NumberIntegerType = long int; NumberFloatType = double; AllocatorType = std::allocator]’:\r\ntest/unit.cpp:2671:95:   required from here\r\nsrc/json.hpp:1348:44: error: no matching function for call to ‘std::vector<nlohmann::basic_json<> >::erase(__gnu_cxx::__normal_iterator<const nlohmann::basic_json<>*, std::vector<nlohmann::basic_json<> > >&, __gnu_cxx::__normal_iterator<const nlohmann::basic_json<>*, std::vector<nlohmann::basic_json<> > >&)’\r\n                 result.m_it.array_iterator = m_value.array->erase(first.m_it.array_iterator,\r\n                                            ^\r\nsrc/json.hpp:1348:44: note: candidates are:\r\nIn file included from /usr/include/c++/4.8/vector:69:0,\r\n                 from /usr/include/c++/4.8/bits/random.h:34,\r\n                 from /usr/include/c++/4.8/random:50,\r\n                 from /usr/include/c++/4.8/bits/stl_algo.h:65,\r\n                 from /usr/include/c++/4.8/algorithm:62,\r\n                 from test/catch.hpp:62,\r\n                 from test/unit.cpp:11:\r\n/usr/include/c++/4.8/bits/vector.tcc:134:5: note: std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::erase(std::vector<_Tp, _Alloc>::iterator) [with _Tp = nlohmann::basic_json<>; _Alloc = std::allocator<nlohmann::basic_json<> >; std::vector<_Tp, _Alloc>::iterator = __gnu_cxx::__normal_iterator<nlohmann::basic_json<>*, std::vector<nlohmann::basic_json<> > >; typename std::_Vector_base<_Tp, _Alloc>::pointer = nlohmann::basic_json<>*]\r\n     vector<_Tp, _Alloc>::\r\n     ^\r\n/usr/include/c++/4.8/bits/vector.tcc:134:5: note:   candidate expects 1 argument, 2 provided\r\n/usr/include/c++/4.8/bits/vector.tcc:146:5: note: std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::erase(std::vector<_Tp, _Alloc>::iterator, std::vector<_Tp, _Alloc>::iterator) [with _Tp = nlohmann::basic_json<>; _Alloc = std::allocator<nlohmann::basic_json<> >; std::vector<_Tp, _Alloc>::iterator = __gnu_cxx::__normal_iterator<nlohmann::basic_json<>*, std::vector<nlohmann::basic_json<> > >; typename std::_Vector_base<_Tp, _Alloc>::pointer = nlohmann::basic_json<>*]\r\n     vector<_Tp, _Alloc>::\r\n     ^\r\n/usr/include/c++/4.8/bits/vector.tcc:146:5: note:   no known conversion for argument 1 from ‘__gnu_cxx::__normal_iterator<const nlohmann::basic_json<>*, std::vector<nlohmann::basic_json<> > >’ to ‘std::vector<nlohmann::basic_json<> >::iterator {aka __gnu_cxx::__normal_iterator<nlohmann::basic_json<>*, std::vector<nlohmann::basic_json<> > >}’\r\nmake: *** [json_unit] Error 1\r\n```"},"comment":{"url":"https://api.github.com/repos/nlohmann/json/issues/comments/99552662","html_url":"https://github.com/nlohmann/json/issues/68#issuecomment-99552662","issue_url":"https://api.github.com/repos/nlohmann/json/issues/68","id":99552662,"user":{"login":"nlohmann","id":159488,"avatar_url":"https://avatars.githubusercontent.com/u/159488?v=3","gravatar_id":"","url":"https://api.github.com/users/nlohmann","html_url":"https://github.com/nlohmann","followers_url":"https://api.github.com/users/nlohmann/followers","following_url":"https://api.github.com/users/nlohmann/following{/other_user}","gists_url":"https://api.github.com/users/nlohmann/gists{/gist_id}","starred_url":"https://api.github.com/users/nlohmann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nlohmann/subscriptions","organizations_url":"https://api.github.com/users/nlohmann/orgs","repos_url":"https://api.github.com/users/nlohmann/repos","events_url":"https://api.github.com/users/nlohmann/events{/privacy}","received_events_url":"https://api.github.com/users/nlohmann/received_events","type":"User","site_admin":false},"created_at":"2015-05-06T17:55:52Z","updated_at":"2015-05-06T17:55:52Z","body":"This is a bug in GCC, see [here](http://stackoverflow.com/questions/19559235/stdvectorerase-and-const-iterators-with-g) and [here](https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57158). I see what I can do to circumvent it."}}