We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Given this ADL:
module test { import sys.types.Map; struct Test { Map<Int64, String> foo = []; }; };
generated c++ code will have:
Test::Test() : foo(std::map<int64_t,std::string> (mkvec<std::pair<int64_t,std::string> >())) { }
Which is failed to compile:
test.cpp: In constructor ‘ADL::test::Test::Test()’: test.cpp:8:82: error: no matching function for call to ‘std::map<long int, std::__cxx11::basic_string<char> >::map(std::vector<std::pair<long int, std::__cxx11::basic_string<char> >, std::allocator<std::pair<long int, std::__cxx11::basic_string<char> > > >)’ 8 | : foo(std::map<int64_t,std::string> (mkvec<std::pair<int64_t,std::string> >())) | ^ In file included from /usr/include/c++/9/map:61, from include/adl/types.h:5, from include/adl/adl.h:6, from test.h:4, from test.cpp:2: /usr/include/c++/9/bits/stl_map.h:248:7: note: candidate: ‘std::map<_Key, _Tp, _Compare, _Alloc>::map(std::initializer_list<std::pair<const _Key, _Tp> >, const allocator_type&) [with _Key = long int; _Tp = std::__cxx11::basic_string<char>; _Compare = std::less<long int>; _Alloc = std::allocator<std::pair<const long int, std::__cxx11::basic_string<char> > >; std::map<_Key, _Tp, _Compare, _Alloc>::allocator_type = std::allocator<std::pair<const long int, std::__cxx11::basic_string<char> > >]’ 248 | map(initializer_list<value_type> __l, const allocator_type& __a) | ^~~ /usr/include/c++/9/bits/stl_map.h:248:7: note: candidate expects 2 arguments, 1 provided /usr/include/c++/9/bits/stl_map.h:242:7: note: candidate: ‘std::map<_Key, _Tp, _Compare, _Alloc>::map(std::map<_Key, _Tp, _Compare, _Alloc>&&, const allocator_type&) [with _Key = long int; _Tp = std::__cxx11::basic_string<char>; _Compare = std::less<long int>; _Alloc = std::allocator<std::pair<const long int, std::__cxx11::basic_string<char> > >; std::map<_Key, _Tp, _Compare, _Alloc>::allocator_type = std::allocator<std::pair<const long int, std::__cxx11::basic_string<char> > >]’ 242 | map(map&& __m, const allocator_type& __a) | ^~~ /usr/include/c++/9/bits/stl_map.h:242:7: note: candidate expects 2 arguments, 1 provided /usr/include/c++/9/bits/stl_map.h:238:7: note: candidate: ‘std::map<_Key, _Tp, _Compare, _Alloc>::map(const std::map<_Key, _Tp, _Compare, _Alloc>&, const allocator_type&) [with _Key = long int; _Tp = std::__cxx11::basic_string<char>; _Compare = std::less<long int>; _Alloc = std::allocator<std::pair<const long int, std::__cxx11::basic_string<char> > >; std::map<_Key, _Tp, _Compare, _Alloc>::allocator_type = std::allocator<std::pair<const long int, std::__cxx11::basic_string<char> > >]’ 238 | map(const map& __m, const allocator_type& __a) | ^~~ /usr/include/c++/9/bits/stl_map.h:238:7: note: candidate expects 2 arguments, 1 provided /usr/include/c++/9/bits/stl_map.h:234:7: note: candidate: ‘std::map<_Key, _Tp, _Compare, _Alloc>::map(const allocator_type&) [with _Key = long int; _Tp = std::__cxx11::basic_string<char>; _Compare = std::less<long int>; _Alloc = std::allocator<std::pair<const long int, std::__cxx11::basic_string<char> > >; std::map<_Key, _Tp, _Compare, _Alloc>::allocator_type = std::allocator<std::pair<const long int, std::__cxx11::basic_string<char> > >]’ 234 | map(const allocator_type& __a) | ^~~ /usr/include/c++/9/bits/stl_map.h:234:33: note: no known conversion for argument 1 from ‘std::vector<std::pair<long int, std::__cxx11::basic_string<char> >, std::allocator<std::pair<long int, std::__cxx11::basic_string<char> > > >’ to ‘const allocator_type&’ {aka ‘const std::allocator<std::pair<const long int, std::__cxx11::basic_string<char> > >&’} 234 | map(const allocator_type& __a) | ~~~~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/9/bits/stl_map.h:226:7: note: candidate: ‘std::map<_Key, _Tp, _Compare, _Alloc>::map(std::initializer_list<std::pair<const _Key, _Tp> >, const _Compare&, const allocator_type&) [with _Key = long int; _Tp = std::__cxx11::basic_string<char>; _Compare = std::less<long int>; _Alloc = std::allocator<std::pair<const long int, std::__cxx11::basic_string<char> > >; std::map<_Key, _Tp, _Compare, _Alloc>::allocator_type = std::allocator<std::pair<const long int, std::__cxx11::basic_string<char> > >]’ 226 | map(initializer_list<value_type> __l, | ^~~ /usr/include/c++/9/bits/stl_map.h:226:40: note: no known conversion for argument 1 from ‘std::vector<std::pair<long int, std::__cxx11::basic_string<char> >, std::allocator<std::pair<long int, std::__cxx11::basic_string<char> > > >’ to ‘std::initializer_list<std::pair<const long int, std::__cxx11::basic_string<char> > >’ 226 | map(initializer_list<value_type> __l, | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/9/bits/stl_map.h:213:7: note: candidate: ‘std::map<_Key, _Tp, _Compare, _Alloc>::map(std::map<_Key, _Tp, _Compare, _Alloc>&&) [with _Key = long int; _Tp = std::__cxx11::basic_string<char>; _Compare = std::less<long int>; _Alloc = std::allocator<std::pair<const long int, std::__cxx11::basic_string<char> > >]’ 213 | map(map&&) = default; | ^~~ /usr/include/c++/9/bits/stl_map.h:213:11: note: no known conversion for argument 1 from ‘std::vector<std::pair<long int, std::__cxx11::basic_string<char> >, std::allocator<std::pair<long int, std::__cxx11::basic_string<char> > > >’ to ‘std::map<long int, std::__cxx11::basic_string<char> >&&’ 213 | map(map&&) = default; | ^~~~~ /usr/include/c++/9/bits/stl_map.h:205:7: note: candidate: ‘std::map<_Key, _Tp, _Compare, _Alloc>::map(const std::map<_Key, _Tp, _Compare, _Alloc>&) [with _Key = long int; _Tp = std::__cxx11::basic_string<char>; _Compare = std::less<long int>; _Alloc = std::allocator<std::pair<const long int, std::__cxx11::basic_string<char> > >]’ 205 | map(const map&) = default; | ^~~ /usr/include/c++/9/bits/stl_map.h:205:11: note: no known conversion for argument 1 from ‘std::vector<std::pair<long int, std::__cxx11::basic_string<char> >, std::allocator<std::pair<long int, std::__cxx11::basic_string<char> > > >’ to ‘const std::map<long int, std::__cxx11::basic_string<char> >&’ 205 | map(const map&) = default; | ^~~~~~~~~~ /usr/include/c++/9/bits/stl_map.h:192:7: note: candidate: ‘std::map<_Key, _Tp, _Compare, _Alloc>::map(const _Compare&, const allocator_type&) [with _Key = long int; _Tp = std::__cxx11::basic_string<char>; _Compare = std::less<long int>; _Alloc = std::allocator<std::pair<const long int, std::__cxx11::basic_string<char> > >; std::map<_Key, _Tp, _Compare, _Alloc>::allocator_type = std::allocator<std::pair<const long int, std::__cxx11::basic_string<char> > >]’ 192 | map(const _Compare& __comp, | ^~~ /usr/include/c++/9/bits/stl_map.h:192:27: note: no known conversion for argument 1 from ‘std::vector<std::pair<long int, std::__cxx11::basic_string<char> >, std::allocator<std::pair<long int, std::__cxx11::basic_string<char> > > >’ to ‘const std::less<long int>&’ 192 | map(const _Compare& __comp, | ~~~~~~~~~~~~~~~~^~~~~~ /usr/include/c++/9/bits/stl_map.h:183:7: note: candidate: ‘std::map<_Key, _Tp, _Compare, _Alloc>::map() [with _Key = long int; _Tp = std::__cxx11::basic_string<char>; _Compare = std::less<long int>; _Alloc = std::allocator<std::pair<const long int, std::__cxx11::basic_string<char> > >]’ 183 | map() = default; | ^~~ /usr/include/c++/9/bits/stl_map.h:183:7: note: candidate expects 0 arguments, 1 provided
The text was updated successfully, but these errors were encountered:
This is a missing feature - the c++ backend doesn't support default values for custom type mappings.
Sorry, something went wrong.
No branches or pull requests
Given this ADL:
generated c++ code will have:
Which is failed to compile:
The text was updated successfully, but these errors were encountered: