I'm compiling a large program with gcc-4.4.7 --std=c++0x and several libraries from boost-1.53. The compiler is complaining about a bunch of errors in the boost libraries (below), but not about my code. Is this a bug in boost libraries? How would I go about figuring out what's wrong? Any suggestions appreciated!
/usr/bin/g++ -O0 -ggdb -fno-inline --std=c++0x -pedantic -Wall -fno-strict-aliasing -Wno-non-template-friend -Wno-long-long -Wno-deprecated -m64 -I /home/user1/pkg/boost-64bit -I/data/home_local/user2/dev/bbb-onForge-trunk/src -I/data/home_local/user2/dev/bbb-onForge-trunk/src/util/containers -I/data/home_local/user2/dev/bbb-onForge-trunk/src/util/misc -I /usr/include -c -o /data/home_local/user2/dev/bbb-onForge-trunk/obj/Linux/dbg/bbb/trainOne.o /data/home_local/user2/dev/bbb-onForge-trunk/src/bbb/trainOne.cpp
In file included from /home/user1/pkg/boost-64bit/boost/filesystem/path_traits.hpp:23,
from /home/user1/pkg/boost-64bit/boost/filesystem/path.hpp:25,
from /home/user1/pkg/boost-64bit/boost/filesystem.hpp:16,
from /data/home_local/user2/dev/bbb-onForge-trunk/src/bbb/parameter.hpp:31,
from /data/home_local/user2/dev/bbb-onForge-trunk/src/bbb/trainOne.cpp:6:
/home/user1/pkg/boost-64bit/boost/system/error_code.hpp: In function 'boost::system::error_code& boost::throws()':
/home/user1/pkg/boost-64bit/boost/system/error_code.hpp:410: error: reference to 'detail' is ambiguous
/home/user1/pkg/boost-64bit/boost/type_traits/is_reference.hpp:25: error: candidates are: namespace boost::detail { }
/home/user1/pkg/boost-64bit/boost/tuple/detail/tuple_basic.hpp:51: error: namespace boost::tuples::detail { }
In file included from /home/user1/pkg/boost-64bit/boost/tokenizer.hpp:20,
from /home/user1/pkg/boost-64bit/boost/date_time/date_parsing.hpp:15,
from /home/user1/pkg/boost-64bit/boost/date_time/gregorian/parsers.hpp:13,
from /home/user1/pkg/boost-64bit/boost/date_time/gregorian/gregorian.hpp:34,
from /home/user1/pkg/boost-64bit/boost/date_time/posix_time/time_formatters.hpp:12,
from /home/user1/pkg/boost-64bit/boost/date_time/posix_time/posix_time.hpp:24,
from /data/home_local/user2/dev/bbb-onForge-trunk/src/util/misc/ResourceUsage.hpp:4,
from /data/home_local/user2/dev/bbb-onForge-trunk/src/bbb/trainOne.cpp:6:
/home/user1/pkg/boost-64bit/boost/token_iterator.hpp: At global scope:
/home/user1/pkg/boost-64bit/boost/token_iterator.hpp:34: error: reference to 'detail' is ambiguous
/home/user1/pkg/boost-64bit/boost/type_traits/is_reference.hpp:25: error: candidates are: namespace boost::detail { }
/home/user1/pkg/boost-64bit/boost/tuple/detail/tuple_basic.hpp:51: error: namespace boost::tuples::detail { }
/home/user1/pkg/boost-64bit/boost/token_iterator.hpp:39: error: template argument 3 is invalid
In file included from /home/user1/pkg/boost-64bit/boost/date_time/gregorian/parsers.hpp:13,
from /home/user1/pkg/boost-64bit/boost/date_time/gregorian/gregorian.hpp:34,
from /home/user1/pkg/boost-64bit/boost/date_time/posix_time/time_formatters.hpp:12,
from /home/user1/pkg/boost-64bit/boost/date_time/posix_time/posix_time.hpp:24,
from /data/home_local/user2/dev/bbb-onForge-trunk/src/util/misc/ResourceUsage.hpp:4,
from /data/home_local/user2/dev/bbb-onForge-trunk/src/bbb/trainOne.cpp:6:
/home/user1/pkg/boost-64bit/boost/date_time/date_parsing.hpp: In function 'date_type boost::date_time::parse_date(const std::string&, int)':
/home/user1/pkg/boost-64bit/boost/date_time/date_parsing.hpp:133: error: no match for 'operator!=' in 'beg != tok.boost::tokenizer<TokenizerFunc, Iterator, Type>::end [with TokenizerFunc = boost::char_separator<char, std::char_traits<char> >, Iterator = __gnu_cxx::__normal_iterator<const char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, Type = std::basic_string<char, std::char_traits<char>, std::allocator<char> >]()'
/home/user1/pkg/boost-64bit/boost/tuple/tuple_comparison.hpp:41: note: candidates are: bool boost::tuples::operator!=(const boost::tuples::null_type&, const boost::tuples::null_type&)
/home/user1/pkg/boost-64bit/boost/blank.hpp:73: note: bool boost::operator!=(const boost::blank&, const boost::blank&)
/home/user1/pkg/boost-64bit/boost/function/function_base.hpp:764: note: bool boost::operator!=(boost::detail::function::useless_clear_type*, const boost::function_base&)
/home/user1/pkg/boost-64bit/boost/function/function_base.hpp:752: note: bool boost::operator!=(const boost::function_base&, boost::detail::function::useless_clear_type*)
/home/user1/pkg/boost-64bit/boost/date_time/date_parsing.hpp:134: error: no match for 'operator++' in '++beg'
/home/user1/pkg/boost-64bit/boost/date_time/date_parsing.hpp:138: error: no match for 'operator*' in '*beg'
/home/user1/pkg/boost-64bit/boost/date_time/date_parsing.hpp:143: error: no match for 'operator*' in '*beg'
/home/user1/pkg/boost-64bit/boost/date_time/date_parsing.hpp:148: error: no match for 'operator*' in '*beg'
/home/user1/pkg/boost-64bit/boost/date_time/date_parsing.hpp: In function 'date_type boost::date_time::parse_undelimited_date(const std::string&)':
/home/user1/pkg/boost-64bit/boost/date_time/date_parsing.hpp:178: error: no match for 'operator!=' in 'ti != tok.boost::tokenizer<TokenizerFunc, Iterator, Type>::end [with TokenizerFunc = boost::offset_separator, Iterator = __gnu_cxx::__normal_iterator<const char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, Type = std::basic_string<char, std::char_traits<char>, std::allocator<char> >]()'
/home/user1/pkg/boost-64bit/boost/tuple/tuple_comparison.hpp:41: note: candidates are: bool boost::tuples::operator!=(const boost::tuples::null_type&, const boost::tuples::null_type&)
/home/user1/pkg/boost-64bit/boost/blank.hpp:73: note: bool boost::operator!=(const boost::blank&, const boost::blank&)
/home/user1/pkg/boost-64bit/boost/function/function_base.hpp:764: note: bool boost::operator!=(boost::detail::function::useless_clear_type*, const boost::function_base&)
/home/user1/pkg/boost-64bit/boost/function/function_base.hpp:752: note: bool boost::operator!=(const boost::function_base&, boost::detail::function::useless_clear_type*)
/home/user1/pkg/boost-64bit/boost/date_time/date_parsing.hpp:178: error: no match for 'operator++' in '++ti'
/home/user1/pkg/boost-64bit/boost/date_time/date_parsing.hpp:179: error: no match for 'operator*' in '*ti'
In file included from /home/user1/pkg/boost-64bit/boost/date_time/posix_time/time_formatters.hpp:19,
from /home/user1/pkg/boost-64bit/boost/date_time/posix_time/posix_time.hpp:24,
from /data/home_local/user2/dev/bbb-onForge-trunk/src/util/misc/ResourceUsage.hpp:4,
from /data/home_local/user2/dev/bbb-onForge-trunk/src/bbb/trainOne.cpp:6:
/home/user1/pkg/boost-64bit/boost/date_time/time_parsing.hpp: In function 'time_duration boost::date_time::parse_undelimited_time_duration(const std::string&)':
/home/user1/pkg/boost-64bit/boost/date_time/time_parsing.hpp:228: error: no match for 'operator!=' in 'ti != tok.boost::tokenizer<TokenizerFunc, Iterator, Type>::end [with TokenizerFunc = boost::offset_separator, Iterator = __gnu_cxx::__normal_iterator<const char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, Type = std::basic_string<char, std::char_traits<char>, std::allocator<char> >]()'
/home/user1/pkg/boost-64bit/boost/tuple/tuple_comparison.hpp:41: note: candidates are: bool boost::tuples::operator!=(const boost::tuples::null_type&, const boost::tuples::null_type&)
/home/user1/pkg/boost-64bit/boost/blank.hpp:73: note: bool boost::operator!=(const boost::blank&, const boost::blank&)
/home/user1/pkg/boost-64bit/boost/function/function_base.hpp:764: note: bool boost::operator!=(boost::detail::function::useless_clear_type*, const boost::function_base&)
/home/user1/pkg/boost-64bit/boost/function/function_base.hpp:752: note: bool boost::operator!=(const boost::function_base&, boost::detail::function::useless_clear_type*)
/home/user1/pkg/boost-64bit/boost/date_time/time_parsing.hpp:228: error: no match for 'operator++' in '++ti'
/home/user1/pkg/boost-64bit/boost/date_time/time_parsing.hpp:232: error: no match for 'operator*' in '*ti'
/home/user1/pkg/boost-64bit/boost/date_time/time_parsing.hpp:237: error: no match for 'operator*' in '*ti'
/home/user1/pkg/boost-64bit/boost/date_time/time_parsing.hpp:242: error: no match for 'operator*' in '*ti'
/home/user1/pkg/boost-64bit/boost/date_time/time_parsing.hpp:247: error: base operand of '->' has non-pointer type 'boost::date_time::parse_undelimited_time_duration(const std::string&)::tokenizer_iterator'
In file included from /home/user1/pkg/boost-64bit/boost/date_time/gregorian/parsers.hpp:13,
from /home/user1/pkg/boost-64bit/boost/date_time/gregorian/gregorian.hpp:34,
from /home/user1/pkg/boost-64bit/boost/date_time/posix_time/time_formatters.hpp:12,
from /home/user1/pkg/boost-64bit/boost/date_time/posix_time/posix_time.hpp:24,
from /data/home_local/user2/dev/bbb-onForge-trunk/src/util/misc/ResourceUsage.hpp:4,
from /data/home_local/user2/dev/bbb-onForge-trunk/src/bbb/trainOne.cpp:6:
/home/user1/pkg/boost-64bit/boost/date_time/date_parsing.hpp: In function 'boost::date_time::period<date_type, typename date_type::duration_type> boost::date_time::from_simple_string_type(const std::basic_string<charT, std::char_traits<_CharT>, std::allocator<_T2> >&) [with date_type = boost::gregorian::date, charT = char]':
/home/user1/pkg/boost-64bit/boost/date_time/gregorian/parsers.hpp:79: instantiated from here
/home/user1/pkg/boost-64bit/boost/date_time/date_parsing.hpp:299: error: no match for 'operator*' in '*tok_it'
/home/user1/pkg/boost-64bit/boost/date_time/gregorian/parsers.hpp:79: instantiated from here
/home/user1/pkg/boost-64bit/boost/date_time/date_parsing.hpp:305: error: no match for 'operator++' in '++tok_it'
/home/user1/pkg/boost-64bit/boost/date_time/date_parsing.hpp: In function 'boost::date_time::period<date_type, typename date_type::duration_type> boost::date_time::from_simple_string_type(const std::basic_string<charT, std::char_traits<_CharT>, std::allocator<_T2> >&) [with date_type = boost::gregorian::date, charT = wchar_t]':
/home/user1/pkg/boost-64bit/boost/date_time/gregorian/parsers.hpp:84: instantiated from here
/home/user1/pkg/boost-64bit/boost/date_time/date_parsing.hpp:299: error: no match for 'operator*' in '*tok_it'
/home/user1/pkg/boost-64bit/boost/date_time/gregorian/parsers.hpp:84: instantiated from here
/home/user1/pkg/boost-64bit/boost/date_time/date_parsing.hpp:305: error: no match for 'operator++' in '++tok_it'
In file included from /home/user1/pkg/boost-64bit/boost/date_time/posix_time/time_formatters.hpp:19,
from /home/user1/pkg/boost-64bit/boost/date_time/posix_time/posix_time.hpp:24,
from /data/home_local/user2/dev/bbb-onForge-trunk/src/util/misc/ResourceUsage.hpp:4,
from /data/home_local/user2/dev/bbb-onForge-trunk/src/bbb/trainOne.cpp:6:
/home/user1/pkg/boost-64bit/boost/date_time/time_parsing.hpp: In function 'time_duration boost::date_time::str_from_delimited_time_duration(const std::basic_string<charT, std::char_traits<_CharT>, std::allocator<_T2> >&) [with time_duration = boost::posix_time::time_duration, char_type = char]':
/home/user1/pkg/boost-64bit/boost/date_time/time_parsing.hpp:146: instantiated from 'time_duration boost::date_time::parse_delimited_time_duration(const std::string&) [with time_duration = boost::posix_time::time_duration]'
/home/user1/pkg/boost-64bit/boost/date_time/posix_time/time_parsers.hpp:27: instantiated from here
/home/user1/pkg/boost-64bit/boost/date_time/time_parsing.hpp:68: error: no match for 'operator!=' in 'beg != boost::tokenizer<TokenizerFunc, Iterator, Type>::end() const [with TokenizerFunc = boost::char_separator<char, std::char_traits<char> >, Iterator = __gnu_cxx::__normal_iterator<const char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, Type = std::basic_string<char, std::char_traits<char>, std::allocator<char> >]()'
/home/user1/pkg/boost-64bit/boost/tuple/tuple_comparison.hpp:41: note: candidates are: bool boost::tuples::operator!=(const boost::tuples::null_type&, const boost::tuples::null_type&)
/home/user1/pkg/boost-64bit/boost/blank.hpp:73: note: bool boost::operator!=(const boost::blank&, const boost::blank&)
/home/user1/pkg/boost-64bit/boost/function/function_base.hpp:764: note: bool boost::operator!=(boost::detail::function::useless_clear_type*, const boost::function_base&)
/home/user1/pkg/boost-64bit/boost/function/function_base.hpp:752: note: bool boost::operator!=(const boost::function_base&, boost::detail::function::useless_clear_type*)
/home/user1/pkg/boost-64bit/boost/date_time/time_parsing.hpp:68: error: no match for 'operator++' in '++beg'
/home/user1/pkg/boost-64bit/boost/date_time/time_parsing.hpp:71: error: no match for 'operator*' in '*beg'
/home/user1/pkg/boost-64bit/boost/date_time/time_parsing.hpp:75: error: no match for 'operator*' in '*beg'
/home/user1/pkg/boost-64bit/boost/date_time/time_parsing.hpp:79: error: no match for 'operator*' in '*beg'
/home/user1/pkg/boost-64bit/boost/date_time/time_parsing.hpp:83: error: base operand of '->' has non-pointer type 'boost::date_time::str_from_delimited_time_duration(const std::basic_string<charT, std::char_traits<_CharT>, std::allocator<_T2> >&) [with time_duration = boost::posix_time::time_duration, char_type = char]::tokenizer_iterator'
/home/user1/pkg/boost-64bit/boost/date_time/time_parsing.hpp:104: error: base operand of '->' has non-pointer type 'boost::date_time::str_from_delimited_time_duration(const std::basic_string<charT, std::char_traits<_CharT>, std::allocator<_T2> >&) [with time_duration = boost::posix_time::time_duration, char_type = char]::tokenizer_iterator'
/home/user1/pkg/boost-64bit/boost/date_time/time_parsing.hpp:107: error: no match for 'operator*' in '*beg'
Are you doing the below in your code ?
using namespace boost;
using namespace boost::tuples;
If so, Compiler is not able to judge which detail to use from the below files.
/home/user1/pkg/boost-64bit/boost/type_traits/is_reference.hpp
/home/user1/pkg/boost-64bit/boost/tuple/detail/tuple_basic.hpp
Related
When I run "upper_bound" with a comparator it gives me this error: error: reference to type 'const std::vector<int, std::allocator>' could not bind to an lvalue of type 'const int. Anyone know the issue?
static bool compareInterval(const vector<int>& a, const vector<int>& b) {
return (a[0] < b[0]);
}
vector<int> corpFlightBookings(vector<vector<int>>& bookings, int n) {
vector<int> ret(n, 0);
sort(bookings.begin(), bookings.end(), compareInterval);
for (int i = 0; i < n; ++i) {
auto low=upper_bound(bookings.begin(), bookings.end(), i, compareInterval);
}
return ret;
}
In file included from prog_joined.cpp:1: In file included from
./precompiled/headers.h:13: In file included from
/usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/cmath:1927:
In file included from
/usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/specfun.h:45:
In file included from
/usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/stl_algobase.h:71:
/usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/predefined_ops.h:215:24:
error: reference to type 'const std::vector<int, std::allocator>'
could not bind to an lvalue of type 'const int'
{ return bool(_M_comp(__val, __it)); }
^~~~~ /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/stl_algo.h:2051:8:
note: in instantiation of function template specialization
'__gnu_cxx::__ops::_Val_comp_iter<bool ()(const std::vector<int,
std::allocator> &, const std::vector<int, std::allocator>
&)>::operator()<const int,
__gnu_cxx::__normal_iterator<std::vector<int, std::allocator> *, std::vector<std::vector<int, std::allocator>,
std::allocator<std::vector<int, std::allocator>>>>>' requested
here
if (__comp(__val, __middle))
^ /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/stl_algo.h:2116:19:
note: in instantiation of function template specialization
'std::__upper_bound<__gnu_cxx::__normal_iterator<std::vector<int,
std::allocator> , std::vector<std::vector<int,
std::allocator>, std::allocator<std::vector<int,
std::allocator>>>>, int, __gnu_cxx::__ops::_Val_comp_iter<bool
()(const std::vector<int, std::allocator> &, const
std::vector<int, std::allocator> &)>>' requested here
return std::__upper_bound(__first, __last, __val,
^ Line 12: Char 22: note: in instantiation of function template specialization
'std::upper_bound<__gnu_cxx::__normal_iterator<std::vector<int,
std::allocator> , std::vector<std::vector<int,
std::allocator>, std::allocator<std::vector<int,
std::allocator>>>>, int, bool ()(const std::vector<int,
std::allocator> &, const std::vector<int, std::allocator>
&)>' requested here
auto low=upper_bound(bookings.begin(), bookings.end(), i, compareInterval);
^ 1 error generated.
It turns out "i" needs to be wrapped up to become the same type as an element of bookings
I have the following code
class MyValue
{
std::any value;
MyValue(std::any value)
: value(value)
{
}
public:
using ErrorType = std::string;
using MaybeMy = std::variant<ErrorType, MyValue>;
static MaybeMy safeWrap(std::any const &obj) noexcept
{
if (std::any_cast<int>(&obj) != nullptr)
return MyValue(obj);
else
return ErrorType("There is some alien type");
}
operator std::string() const
{
return std::to_string(std::any_cast<int>(value));
}
MyValue(MyValue &&) = default;
};
int main()
{
auto printer = [](auto &&v) { std::cout << std::string(v) << std::endl; };
MyValue::MaybeMy as[] = {MyValue::safeWrap(10), MyValue::safeWrap("10")};
for (auto &&v : as)
std::visit(printer, v);
}
But I receive errors related with std::variant - MyValue is not constructible.
I cannot understand reasons for this.
Why is MyValue not constructible? And why is there some restriction to execute the code?
Compiler's output:
[build] In file included from /usr/include/c++/9/variant:36,
[build] from /home/created/Documents/Cpp/gstream_test/main.cpp:8:
[build] /usr/include/c++/9/type_traits: In instantiation of ‘struct std::__and_<std::is_copy_constructible<MyValue>, std::is_constructible<MyValue, const MyValue&> >’:
[build] /usr/include/c++/9/any:181:58: required by substitution of ‘template<class _ValueType, class _Tp, class _Mgr, typename std::enable_if<std::__and_<std::is_copy_constructible<_Tp>, std::is_constructible<_Tp, _ValueType&&> >::value, bool>::type <anonymous>, typename std::enable_if<(! std::__is_in_place_type<_Tp>::value), bool>::type <anonymous> > std::any::any(_ValueType&&) [with _ValueType = const MyValue&; _Tp = MyValue; _Mgr = std::any::_Manager_external<MyValue>; typename std::enable_if<std::__and_<std::is_copy_constructible<_Tp>, std::is_constructible<_Tp, _ValueType&&> >::value, bool>::type <anonymous> = <missing>; typename std::enable_if<(! std::__is_in_place_type<_Tp>::value), bool>::type <anonymous> = <missing>]’
[build] /usr/include/c++/9/type_traits:883:12: required from ‘struct std::is_constructible<MyValue, const MyValue&>’
[build] /usr/include/c++/9/type_traits:901:12: required from ‘struct std::__is_copy_constructible_impl<MyValue, true>’
[build] /usr/include/c++/9/type_traits:907:12: required from ‘struct std::is_copy_constructible<MyValue>’
[build] /usr/include/c++/9/type_traits:2925:25: required from ‘constexpr const bool std::is_copy_constructible_v<MyValue>’
[build] /usr/include/c++/9/variant:275:5: required from ‘constexpr const bool std::__detail::__variant::_Traits<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, MyValue>::_S_copy_ctor’
[build] /usr/include/c++/9/variant:1220:11: required from ‘class std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, MyValue>’
[build] /home/created/Documents/Cpp/gstream_test/main.cpp:26:5: required from here
[build] /usr/include/c++/9/type_traits:131:12: error: incomplete type ‘std::is_copy_constructible<MyValue>’ used in nested name specifier
[build] 131 | struct __and_<_B1, _B2>
[build] | ^~~~~~~~~~~~~~~~
[build] /usr/include/c++/9/type_traits: In instantiation of ‘struct std::__and_<std::is_copy_constructible<MyValue>, std::__not_<std::is_constructible<MyValue, const MyValue&> >, std::__not_<std::__is_in_place_type<MyValue> > >’:
[build] /usr/include/c++/9/type_traits:150:27: required from ‘constexpr const bool std::__and_v<std::is_copy_constructible<MyValue>, std::__not_<std::is_constructible<MyValue, const MyValue&> >, std::__not_<std::__is_in_place_type<MyValue> > >’
[build] /usr/include/c++/9/any:192:27: required by substitution of ‘template<class _ValueType, class _Tp, class _Mgr, typename std::enable_if<__and_v<std::is_copy_constructible<_Tp>, std::__not_<std::is_constructible<_Tp, _ValueType&&> >, std::__not_<std::__is_in_place_type<_Tp> > >, bool>::type <anonymous> > std::any::any(_ValueType&&) [with _ValueType = const MyValue&; _Tp = MyValue; _Mgr = std::any::_Manager_external<MyValue>; typename std::enable_if<__and_v<std::is_copy_constructible<_Tp>, std::__not_<std::is_constructible<_Tp, _ValueType&&> >, std::__not_<std::__is_in_place_type<_Tp> > >, bool>::type <anonymous> = <missing>]’
[build] /usr/include/c++/9/type_traits:883:12: required from ‘struct std::is_constructible<MyValue, const MyValue&>’
[build] /usr/include/c++/9/type_traits:901:12: required from ‘struct std::__is_copy_constructible_impl<MyValue, true>’
[build] /usr/include/c++/9/type_traits:907:12: required from ‘struct std::is_copy_constructible<MyValue>’
[build] /usr/include/c++/9/type_traits:2925:25: required from ‘constexpr const bool std::is_copy_constructible_v<MyValue>’
[build] /usr/include/c++/9/variant:275:5: required from ‘constexpr const bool std::__detail::__variant::_Traits<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, MyValue>::_S_copy_ctor’
[build] /usr/include/c++/9/variant:1220:11: required from ‘class std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, MyValue>’
[build] /home/created/Documents/Cpp/gstream_test/main.cpp:26:5: required from here
[build] /usr/include/c++/9/type_traits:136:12: error: incomplete type ‘std::is_copy_constructible<MyValue>’ used in nested name specifier
[build] 136 | struct __and_<_B1, _B2, _B3, _Bn...>
[build] | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[build] /usr/include/c++/9/type_traits: In instantiation of ‘constexpr const bool std::__and_v<std::is_copy_constructible<MyValue>, std::__not_<std::is_constructible<MyValue, const MyValue&> >, std::__not_<std::__is_in_place_type<MyValue> > >’:
[build] /usr/include/c++/9/any:192:27: required by substitution of ‘template<class _ValueType, class _Tp, class _Mgr, typename std::enable_if<__and_v<std::is_copy_constructible<_Tp>, std::__not_<std::is_constructible<_Tp, _ValueType&&> >, std::__not_<std::__is_in_place_type<_Tp> > >, bool>::type <anonymous> > std::any::any(_ValueType&&) [with _ValueType = const MyValue&; _Tp = MyValue; _Mgr = std::any::_Manager_external<MyValue>; typename std::enable_if<__and_v<std::is_copy_constructible<_Tp>, std::__not_<std::is_constructible<_Tp, _ValueType&&> >, std::__not_<std::__is_in_place_type<_Tp> > >, bool>::type <anonymous> = <missing>]’
[build] /usr/include/c++/9/type_traits:883:12: required from ‘struct std::is_constructible<MyValue, const MyValue&>’
[build] /usr/include/c++/9/type_traits:901:12: required from ‘struct std::__is_copy_constructible_impl<MyValue, true>’
[build] /usr/include/c++/9/type_traits:907:12: required from ‘struct std::is_copy_constructible<MyValue>’
[build] /usr/include/c++/9/type_traits:2925:25: required from ‘constexpr const bool std::is_copy_constructible_v<MyValue>’
[build] /usr/include/c++/9/variant:275:5: required from ‘constexpr const bool std::__detail::__variant::_Traits<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, MyValue>::_S_copy_ctor’
[build] /usr/include/c++/9/variant:1220:11: required from ‘class std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, MyValue>’
[build] /home/created/Documents/Cpp/gstream_test/main.cpp:26:5: required from here
[build] /usr/include/c++/9/type_traits:150:27: error: ‘value’ is not a member of ‘std::__and_<std::is_copy_constructible<MyValue>, std::__not_<std::is_constructible<MyValue, const MyValue&> >, std::__not_<std::__is_in_place_type<MyValue> > >’
[build] 150 | inline constexpr bool __and_v = __and_<_Bn...>::value;
[build] | ^~~~~~~
I'm using gcc 9.3
This is a gcc bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90415
It was fixed in gcc 8 and gcc 10+.
The error happens when you have a constructor taking a std::any, which instantiates some type traits really early and breaks stuff, and makes a hard error when you try to move your type (since it also considers the implicit conversion to std::any)
A workaround is to not have a constructor taking std::any, by adding a dummy parameter:
MyValue(int, std::any value)
: value(value)
{
}
// ...
return MyValue(0, obj);
Or using std::experimental::any/std::experimental::fundamentals_v1::any instead
The default accessibility for class members is private. Since your constructor comes before the public: declaration, nobody can construct any objects of this class.
I know there are already several topics related to overloading the copy and assignment operators of base classes - but after two days of trying, I wasn't able to properly do this using boost::filesystem::path.
What I currently have:
using namespace boost::filesystem;
class MyPath: public path
{
public:
template<class C>
MyPath(const C* p): path(p)// dispatch to base copy constructor
{
//http://stackoverflow.com/questions/1226634/how-to-use-base-classs-constructors-and-assignment-operator-in-c
//this one seems to be OK
}
MyPath& operator=(const MyPath& p)
{
path::operator=(p);
return *this;
}
bool myStuff(){/*...*/}
/* ... */
}
Then, I use the MyPath class just like 'path' before:
using namespace std;
using namespace boost::filesystem;
list<MyPath> files_list;
MyPath input_folder("a valid path");
copy(recursive_directory_iterator(input_folder), recursive_directory_iterator(), back_inserter(files_list));
This code works OK with path, but with MyPath I have problems with the assignment operator, and I haven't figured out how yet what is the format of the operator= that it's required by the std::list and the iterators..
g++ -g -Ic:/mingw/include -c main.cpp
In file included from c:\mingw\include\c++\4.8.1\bits\char_traits.h:39:0,
from c:\mingw\include\c++\4.8.1\ios:40,
from c:\mingw\include\c++\4.8.1\ostream:38,
from c:\mingw\include\c++\4.8.1\iostream:39,
from main.cpp:1:
c:\mingw\include\c++\4.8.1\bits\stl_algobase.h: In instantiation of 'static _OI std::__copy_move<<anonymous>, <anonymous>, <template-parameter-1-3> >::__copy_m(_II, _II, _OI) [with _II = boost::filesystem::recursive_directory_iterator; _OI = std::back_insert_iterator<std::list<MyPath> >; bool <anonymous> = false; bool <anonymous> = false; <template-parameter-1-3> = std::input_iterator_tag]':
c:\mingw\include\c++\4.8.1\bits\stl_algobase.h:390:70: required from '_OI std::__copy_move_a(_II, _II, _OI) [with bool _IsMove = false; _II = boost::filesystem::recursive_directory_iterator; _OI = std::back_insert_iterator<std::list<MyPath> >]'
c:\mingw\include\c++\4.8.1\bits\stl_algobase.h:428:38: required from '_OI std::__copy_move_a2(_II, _II, _OI) [with bool _IsMove = false; _II = boost::filesystem::recursive_directory_iterator; _OI = std::back_insert_iterator<std::list<MyPath> >]'
c:\mingw\include\c++\4.8.1\bits\stl_algobase.h:460:17: required from '_OI std::copy(_II, _II, _OI) [with _II = boost::filesystem::recursive_directory_iterator; _OI = std::back_insert_iterator<std::list< MyPath> >]'
main.cpp:23:115: required from here
c:\mingw\include\c++\4.8.1\bits\stl_algobase.h:305:16: error: no match for 'operator=' (operand types are 'std::back_insert_iterator<std::list<MyPath> >' and 'boost::filesystem::directory_entry')
*__result = *__first;
^
c:\mingw\include\c++\4.8.1\bits\stl_algobase.h:305:16: note: candidates are:
In file included from c:\mingw\include\c++\4.8.1\bits\stl_algobase.h:67:0,
from c:\mingw\include\c++\4.8.1\bits\char_traits.h:39,
from c:\mingw\include\c++\4.8.1\ios:40,
from c:\mingw\include\c++\4.8.1\ostream:38,
from c:\mingw\include\c++\4.8.1\iostream:39,
from main.cpp:1:
c:\mingw\include\c++\4.8.1\bits\stl_iterator.h:436:7: note: std::back_insert_iterator<_Container>& std::back_insert_iterator<_Container>::operator=(const typename _Container::value_type&) [with _Container = std::list<MyPath>; typename _Container::value_type = MyPath]
operator=(const typename _Container::value_type& __value)
^
c:\mingw\include\c++\4.8.1\bits\stl_iterator.h:436:7: note: no known conversion for argument 1 from 'boost::filesystem::directory_entry' to 'const value_type& {aka const MyPath&}'
c:\mingw\include\c++\4.8.1\bits\stl_iterator.h:443:7: note: std::back_insert_iterator<_Container>& std::back_insert_iterator<_Container>::operator=(typename _Container::value_type&&) [with _Container = std::list<MyPath>; typename _Container::value_type = MyPath]
operator=(typename _Container::value_type&& __value)
^
c:\mingw\include\c++\4.8.1\bits\stl_iterator.h:443:7: note: no known conversion for argument 1 from 'boost::filesystem::directory_entry' to 'std::list<MyPath>::value_type&& {aka MyPath&&}'
c:\mingw\include\c++\4.8.1\bits\stl_iterator.h:402:11: note: std::back_insert_iterator<std::list<MyPath> >& std::back_insert_iterator<std::list<MyPath> >::operator=(const std::back_insert_iterator<std::list< MyPath> >&)
class back_insert_iterator
^
c:\mingw\include\c++\4.8.1\bits\stl_iterator.h:402:11: note: no known conversion for argument 1 from 'boost::filesystem::directory_entry' to 'const std::back_insert_iterator<std::list<MyPath> >&'
c:\mingw\include\c++\4.8.1\bits\stl_iterator.h:402:11: note: std::back_insert_iterator<std::list<MyPath> >& std::back_insert_iterator<std::list<MyPath> >::operator=(std::back_insert_iterator<std::list<MyPath> >&&)
c:\mingw\include\c++\4.8.1\bits\stl_iterator.h:402:11: note: no known conversion for argument 1 from 'boost::filesystem::directory_entry' to 'std::back_insert_iterator<std::list<MyPath> >&&'
make: *** [main.o] Error 1
The compiler is telling you what you need:
'operator=' (operand types are 'std::back_insert_iterator<std::list<MyPath> >' and 'boost::filesystem::directory_entry')
So you need to implement one more method (at least).
This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.
Closed 10 years ago.
I have a single source file C++ program I'm trying to compile.
The header file looks like:
class merge {
public:
explicit merge(int argc, char* argv[]);
virtual ~merge();
};
And the source file looks like:
int main(int argc, char* argv[])
{
merge mrg(argc,argv);
return 0;
}
merge::merge(map<string,string>& params) {
//code
}
Trying to compile with:
g++ merge.cpp -o merge
I get:
merge.cpp: In function ‘int main(int, char**)’:
merge.cpp:10: error: reference to ‘merge’ is ambiguous
merge.h:12: error: candidates are: class merge
/usr/lib/gcc/x86_64-redhat- linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_algo.h:3180: error: template<class _InputIterator1, class _InputIterator2, class _OutputIterator, class _Compare> _OutputIterator std::merge(_InputIterator1, _InputIterator1, _InputIterator2, _InputIterator2, _OutputIterator, _Compare)
/usr/lib/gcc/x86_64-redhat- linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_algo.h:3122: error: template<class _InputIterator1, class _InputIterator2, class _OutputIterator> _OutputIterator std::merge(_InputIterator1, _InputIterator1, _InputIterator2, _InputIterator2, _OutputIterator)
merge.cpp:10: error: reference to ‘merge’ is ambiguous
merge.h:12: error: candidates are: class merge
/usr/lib/gcc/x86_64-redhat- linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_algo.h:3180: error: template<class _InputIterator1, class _InputIterator2, class _OutputIterator, class _Compare> _OutputIterator std::merge(_InputIterator1, _InputIterator1, _InputIterator2, _InputIterator2, _OutputIterator, _Compare)
/usr/lib/gcc/x86_64-redhat- linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_algo.h:3122: error: template<class _InputIterator1, class _InputIterator2, class _OutputIterator> _OutputIterator std::merge(_InputIterator1, _InputIterator1, _InputIterator2, _InputIterator2, _OutputIterator)
merge.cpp:10: error: expected `;' before ‘mrg’
merge.cpp: At global scope:
merge.cpp:14: error: prototype for ‘merge::merge(std::map<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<const std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >&)’ does not match any in class ‘merge’
merge.h:12: error: candidates are: merge::merge(const merge&)
merge.h:14: error: merge::merge(int, char**)
merge.cpp: In constructor ‘merge::merge(std::map<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<const std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >&)’:
merge.cpp:15: error: declaration of ‘std::map<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<const std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > params’ shadows a parameter
merge.cpp:16: error: ‘argc’ was not declared in this scope
merge.cpp:16: error: ‘argv’ was not declared in this scope
/usr/lib/gcc/x86_64-redhat- linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_iterator_base_types.h: At global scope:
/usr/lib/gcc/x86_64-redhat- linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_iterator_base_types.h: In instantiation of ‘std::iterator_traits<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >’:
/usr/lib/gcc/x86_64-redhat- linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_vector.h:803: instantiated from ‘void std::vector<_Tp, _Alloc>::_M_initialize_dispatch(_InputIterator, _InputIterator, __false_type) [with _InputIterator = std::basic_string<char, std::char_traits<char>, std::allocator<char> >, _Tp = int, _Alloc = std::allocator<int>]’
/usr/lib/gcc/x86_64-redhat- linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_vector.h:262: instantiated from ‘std::vector<_Tp, _Alloc>::vector(_InputIterator, _InputIterator, const _Alloc&) [with _InputIterator = std::basic_string<char, std::char_traits<char>, std::allocator<char> >, _Tp = int, _Alloc = std::allocator<int>]’
merge.cpp:86: instantiated from here
/usr/lib/gcc/x86_64-redhat- linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_iterator_base_types.h:129: error: no type named ‘iterator_category’ in ‘struct std::basic_string<char, std::char_traits<char>, std::allocator<char> >’
Any idea what's wrong?
In the class declaration you have
explicit merge(int argc, char* argv[]);
But when you provide a definition for the constructor you have
merge::merge(map<string,string>& params) { /* ... */ }
Of course, the two must match.
Also, it seems you have a using namespace std; statement in your code somewhere. The compiler cannot resolve whether the calls to merge are to your merge class constructor or to std::merge.
The lesson to take away from this (other than fix your constructor):
DO NOT add using namespace std; anywhere in your code. std:: is not very cumbersome to type.
The signature of merge's constructor does not match its definition.
In your class declaration, you defined merge::merge to take in two parameters, one int and the other char*. In the definition for merge::merge, however, you define it as taking in only one parameter of type map<string,string>&
I'm trying to use STLPort in my project, and when I follow the directions in INSTALL.unixes I get compile errors.
I ran ./configure, then make, the output is below. I'm using make 3.81 and gcc 4.6.1 on Ubuntu.
Edit: I tried adding --with-extra-cxxflags="-std=c++ox" and I get a different and smaller set of errors, listed below.
In file included from ../stlport/memory:45:0,
from reachable.cc:16:
../stlport/stl/_shared_ptr.h:377:43: error: function definition does not declare parameters
../stlport/stl/_shared_ptr.h:421:39: error: declaration of ‘operator=’ as non-function
../stlport/stl/_shared_ptr.h:421:26: error: expected ‘;’ at end of member declaration
../stlport/stl/_shared_ptr.h:421:39: error: function definition does not declare parameters
../stlport/stl/_shared_ptr.h:463:17: error: ‘nullptr_t’ has not been declared
../stlport/stl/_shared_ptr.h:536:43: error: function definition does not declare parameters
../stlport/stl/_shared_ptr.h:552:39: error: declaration of ‘operator=’ as non-function
../stlport/stl/_shared_ptr.h:552:26: error: expected ‘;’ at end of member declaration
../stlport/stl/_shared_ptr.h:552:39: error: function definition does not declare parameters
../stlport/stl/_shared_ptr.h:591:17: error: ‘nullptr_t’ has not been declared
In file included from ../stlport/memory:45:0,
from reachable.cc:16:
../stlport/stl/_shared_ptr.h:643:45: error: ‘nullptr_t’ has not been declared
../stlport/stl/_shared_ptr.h:647:18: error: declaration of ‘operator==’ as non-function
../stlport/stl/_shared_ptr.h:647:18: error: ‘nullptr_t’ was not declared in this scope
../stlport/stl/_shared_ptr.h:647:18: note: suggested alternative:
/usr/include/c++/4.6/i686-linux-gnu/./bits/c++config.h:159:29: note: ‘std::nullptr_t’
../stlport/stl/_shared_ptr.h:647:29: error: expected primary-expression before ‘const’
../stlport/stl/_shared_ptr.h:647:50: error: expected primary-expression before ‘>’ token
../stlport/stl/_shared_ptr.h:647:53: error: ‘x’ was not declared in this scope
../stlport/stl/_shared_ptr.h:651:45: error: ‘nullptr_t’ has not been declared
../stlport/stl/_shared_ptr.h:655:18: error: declaration of ‘operator!=’ as non-function
../stlport/stl/_shared_ptr.h:655:18: error: ‘nullptr_t’ was not declared in this scope
../stlport/stl/_shared_ptr.h:655:18: note: suggested alternative:
/usr/include/c++/4.6/i686-linux-gnu/./bits/c++config.h:159:29: note: ‘std::nullptr_t’
../stlport/stl/_shared_ptr.h:655:29: error: expected primary-expression before ‘const’
../stlport/stl/_shared_ptr.h:655:50: error: expected primary-expression before ‘>’ token
../stlport/stl/_shared_ptr.h:655:53: error: ‘x’ was not declared in this scope
../stlport/stl/_shared_ptr.h:660:44: error: ‘nullptr_t’ has not been declared
../stlport/stl/_shared_ptr.h:665:17: error: declaration of ‘operator<’ as non-function
../stlport/stl/_shared_ptr.h:665:17: error: ‘nullptr_t’ was not declared in this scope
../stlport/stl/_shared_ptr.h:665:17: note: suggested alternative:
/usr/include/c++/4.6/i686-linux-gnu/./bits/c++config.h:159:29: note: ‘std::nullptr_t’
../stlport/stl/_shared_ptr.h:665:28: error: expected primary-expression before ‘const’
../stlport/stl/_shared_ptr.h:665:49: error: expected primary-expression before ‘>’ token
../stlport/stl/_shared_ptr.h:665:52: error: ‘x’ was not declared in this scope
../stlport/stl/_shared_ptr.h:669:44: error: ‘nullptr_t’ has not been declared
../stlport/stl/_shared_ptr.h:673:17: error: declaration of ‘operator>’ as non-function
../stlport/stl/_shared_ptr.h:673:17: error: ‘nullptr_t’ was not declared in this scope
../stlport/stl/_shared_ptr.h:673:17: note: suggested alternative:
/usr/include/c++/4.6/i686-linux-gnu/./bits/c++config.h:159:29: note: ‘std::nullptr_t’
../stlport/stl/_shared_ptr.h:673:28: error: expected primary-expression before ‘const’
../stlport/stl/_shared_ptr.h:673:49: error: expected primary-expression before ‘>’ token
../stlport/stl/_shared_ptr.h:673:52: error: ‘x’ was not declared in this scope
../stlport/stl/_shared_ptr.h:677:45: error: ‘nullptr_t’ has not been declared
../stlport/stl/_shared_ptr.h:681:18: error: declaration of ‘operator<=’ as non-function
../stlport/stl/_shared_ptr.h:681:18: error: ‘nullptr_t’ was not declared in this scope
../stlport/stl/_shared_ptr.h:681:18: note: suggested alternative:
/usr/include/c++/4.6/i686-linux-gnu/./bits/c++config.h:159:29: note: ‘std::nullptr_t’
../stlport/stl/_shared_ptr.h:681:29: error: expected primary-expression before ‘const’
../stlport/stl/_shared_ptr.h:681:50: error: expected primary-expression before ‘>’ token
../stlport/stl/_shared_ptr.h:681:53: error: ‘x’ was not declared in this scope
../stlport/stl/_shared_ptr.h:685:45: error: ‘nullptr_t’ has not been declared
../stlport/stl/_shared_ptr.h:689:18: error: declaration of ‘operator>=’ as non-function
../stlport/stl/_shared_ptr.h:689:18: error: ‘nullptr_t’ was not declared in this scope
../stlport/stl/_shared_ptr.h:689:18: note: suggested alternative:
/usr/include/c++/4.6/i686-linux-gnu/./bits/c++config.h:159:29: note: ‘std::nullptr_t’
../stlport/stl/_shared_ptr.h:689:29: error: expected primary-expression before ‘const’
../stlport/stl/_shared_ptr.h:689:50: error: expected primary-expression before ‘>’ token
../stlport/stl/_shared_ptr.h:689:53: error: ‘x’ was not declared in this scope
../stlport/stl/_shared_ptr.h:775:26: error: expected ‘)’ before ‘,’ token
../stlport/stl/_shared_ptr.h:790:26: error: expected ‘)’ before ‘,’ token
../stlport/stl/_shared_ptr.h:917:43: error: function definition does not declare parameters
../stlport/stl/_shared_ptr.h:1160:26: error: expected ‘)’ before ‘,’ token
../stlport/stl/_shared_ptr.h:1175:26: error: expected ‘)’ before ‘,’ token
../stlport/stl/_shared_ptr.h:1296:43: error: function definition does not declare parameters
../stlport/stl/_shared_ptr.h:1553:42: error: ‘nullptr_t’ has not been declared
../stlport/stl/_shared_ptr.h:1557:18: error: declaration of ‘operator==’ as non-function
../stlport/stl/_shared_ptr.h:1557:18: error: ‘nullptr_t’ was not declared in this scope
../stlport/stl/_shared_ptr.h:1557:18: note: suggested alternative:
/usr/include/c++/4.6/i686-linux-gnu/./bits/c++config.h:159:29: note: ‘std::nullptr_t’
../stlport/stl/_shared_ptr.h:1557:29: error: expected primary-expression before ‘const’
../stlport/stl/_shared_ptr.h:1561:42: error: ‘nullptr_t’ has not been declared
../stlport/stl/_shared_ptr.h:1565:18: error: declaration of ‘operator!=’ as non-function
../stlport/stl/_shared_ptr.h:1565:18: error: ‘nullptr_t’ was not declared in this scope
../stlport/stl/_shared_ptr.h:1565:18: note: suggested alternative:
/usr/include/c++/4.6/i686-linux-gnu/./bits/c++config.h:159:29: note: ‘std::nullptr_t’
../stlport/stl/_shared_ptr.h:1565:29: error: expected primary-expression before ‘const’
../stlport/stl/_shared_ptr.h:1569:41: error: ‘nullptr_t’ has not been declared
../stlport/stl/_shared_ptr.h:1573:17: error: declaration of ‘operator<’ as non-function
../stlport/stl/_shared_ptr.h:1573:17: error: ‘nullptr_t’ was not declared in this scope
../stlport/stl/_shared_ptr.h:1573:17: note: suggested alternative:
/usr/include/c++/4.6/i686-linux-gnu/./bits/c++config.h:159:29: note: ‘std::nullptr_t’
../stlport/stl/_shared_ptr.h:1573:28: error: expected primary-expression before ‘const’
../stlport/stl/_shared_ptr.h:1577:42: error: ‘nullptr_t’ has not been declared
../stlport/stl/_shared_ptr.h:1581:18: error: declaration of ‘operator<=’ as non-function
../stlport/stl/_shared_ptr.h:1581:18: error: ‘nullptr_t’ was not declared in this scope
../stlport/stl/_shared_ptr.h:1581:18: note: suggested alternative:
/usr/include/c++/4.6/i686-linux-gnu/./bits/c++config.h:159:29: note: ‘std::nullptr_t’
../stlport/stl/_shared_ptr.h:1581:29: error: expected primary-expression before ‘const’
../stlport/stl/_shared_ptr.h:1585:41: error: ‘nullptr_t’ has not been declared
../stlport/stl/_shared_ptr.h:1589:17: error: declaration of ‘operator>’ as non-function
../stlport/stl/_shared_ptr.h:1589:17: error: ‘nullptr_t’ was not declared in this scope
../stlport/stl/_shared_ptr.h:1589:17: note: suggested alternative:
/usr/include/c++/4.6/i686-linux-gnu/./bits/c++config.h:159:29: note: ‘std::nullptr_t’
../stlport/stl/_shared_ptr.h:1589:28: error: expected primary-expression before ‘const’
../stlport/stl/_shared_ptr.h:1593:42: error: ‘nullptr_t’ has not been declared
../stlport/stl/_shared_ptr.h:1597:18: error: declaration of ‘operator>=’ as non-function
../stlport/stl/_shared_ptr.h:1597:18: error: ‘nullptr_t’ was not declared in this scope
../stlport/stl/_shared_ptr.h:1597:18: note: suggested alternative:
/usr/include/c++/4.6/i686-linux-gnu/./bits/c++config.h:159:29: note: ‘std::nullptr_t’
../stlport/stl/_shared_ptr.h:1597:29: error: expected primary-expression before ‘const’
In file included from ../stlport/stl/_hashtable.h:541:0,
from ../stlport/stl/_unordered_map.h:24,
from ../stlport/unordered_map:28,
from reachable.cc:17:
../stlport/stl/_hashtable.c: In member function ‘stlp_std::pair<stlp_std::priv::_Ht_iterator<typename stlp_std::forward_list<_Val, _All>::iterator, typename _Traits::_NonConstTraits>, bool> stlp_std::hashtable<_Val, _Key, _HF, _Traits, _ExK, _EqK, _All>::insert_unique_noresize(const value_type&) [with _Val = stlp_std::pair<void* const, long unsigned int>, _Key = void*, _HF = stlp_std::hash<void*>, _Traits = stlp_std::priv::_UnorderedMapTraitsT<stlp_std::pair<void* const, long unsigned int> >, _ExK = stlp_std::priv::_Select1st<stlp_std::pair<void* const, long unsigned int> >, _EqK = stlp_std::equal_to<void*>, _All = stlp_std::allocator<stlp_std::pair<void* const, long unsigned int> >, typename _Traits::_NonConstTraits = stlp_std::priv::_NonLocalUnorderedMapTraitsT<stlp_std::pair<void* const, long unsigned int> >, typename stlp_std::forward_list<_Val, _All>::iterator = stlp_std::priv::_Slist_iterator<stlp_std::pair<void* const, long unsigned int>, stlp_std::_Nonconst_traits<stlp_std::pair<void* const, long unsigned int> > >, stlp_std::hashtable<_Val, _Key, _HF, _Traits, _ExK, _EqK, _All>::value_type = stlp_std::pair<void* const, long unsigned int>]’:
../stlport/stl/_hashtable.c:251:41: instantiated from ‘stlp_std::hashtable<_Val, _Key, _HF, _Traits, _ExK, _EqK, _All>::reference stlp_std::hashtable<_Val, _Key, _HF, _Traits, _ExK, _EqK, _All>::_M_insert(const value_type&) [with _Val = stlp_std::pair<void* const, long unsigned int>, _Key = void*, _HF = stlp_std::hash<void*>, _Traits = stlp_std::priv::_UnorderedMapTraitsT<stlp_std::pair<void* const, long unsigned int> >, _ExK = stlp_std::priv::_Select1st<stlp_std::pair<void* const, long unsigned int> >, _EqK = stlp_std::equal_to<void*>, _All = stlp_std::allocator<stlp_std::pair<void* const, long unsigned int> >, stlp_std::hashtable<_Val, _Key, _HF, _Traits, _ExK, _EqK, _All>::reference = stlp_std::pair<void* const, long unsigned int>&, stlp_std::hashtable<_Val, _Key, _HF, _Traits, _ExK, _EqK, _All>::value_type = stlp_std::pair<void* const, long unsigned int>]’
../stlport/stl/_unordered_map.h:130:22: instantiated from ‘_Tp& stlp_std::unordered_map<_Key, _Tp, _HashFcn, _EqualKey, _Alloc>::operator[](const _KT&) [with _KT = void*, _Key = void*, _Tp = long unsigned int, _HashFcn = stlp_std::hash<void*>, _EqualKey = stlp_std::equal_to<void*>, _Alloc = stlp_std::allocator<stlp_std::pair<void* const, long unsigned int> >]’
reachable.cc:45:27: instantiated from here
../stlport/stl/_hashtable.c:206:59: error: use of deleted function ‘stlp_std::pair<_T1, _T2>::pair(stlp_std::pair<_T1, _T2>&&) [with _T1 = stlp_std::priv::_Ht_iterator<stlp_std::priv::_Slist_iterator<stlp_std::pair<void* const, long unsigned int>, stlp_std::_Nonconst_traits<stlp_std::pair<void* const, long unsigned int> > >, stlp_std::priv::_NonLocalUnorderedMapTraitsT<stlp_std::pair<void* const, long unsigned int> > >, _T2 = bool, stlp_std::pair<_T1, _T2> = stlp_std::pair<stlp_std::priv::_Ht_iterator<stlp_std::priv::_Slist_iterator<stlp_std::pair<void* const, long unsigned int>, stlp_std::_Nonconst_traits<stlp_std::pair<void* const, long unsigned int> > >, stlp_std::priv::_NonLocalUnorderedMapTraitsT<stlp_std::pair<void* const, long unsigned int> > >, bool>]’
In file included from ../stlport/stl/_alloc.h:53:0,
from ../stlport/memory:30,
from reachable.cc:16:
../stlport/utility:140:3: error: ‘stlp_std::pair<_T1, _T2>::pair(stlp_std::pair<_T1, _T2>&&) [with _T1 = stlp_std::priv::_Ht_iterator<stlp_std::priv::_Slist_iterator<stlp_std::pair<void* const, long unsigned int>, stlp_std::_Nonconst_traits<stlp_std::pair<void* const, long unsigned int> > >, stlp_std::priv::_NonLocalUnorderedMapTraitsT<stlp_std::pair<void* const, long unsigned int> > >, _T2 = bool, stlp_std::pair<_T1, _T2> = stlp_std::pair<stlp_std::priv::_Ht_iterator<stlp_std::priv::_Slist_iterator<stlp_std::pair<void* const, long unsigned int>, stlp_std::_Nonconst_traits<stlp_std::pair<void* const, long unsigned int> > >, stlp_std::priv::_NonLocalUnorderedMapTraitsT<stlp_std::pair<void* const, long unsigned int> > >, bool>]’ is implicitly deleted because the default definition would be ill-formed:
../stlport/utility:140:3: error: non-static data member ‘stlp_std::pair<stlp_std::priv::_Ht_iterator<stlp_std::priv::_Slist_iterator<stlp_std::pair<void* const, long unsigned int>, stlp_std::_Nonconst_traits<stlp_std::pair<void* const, long unsigned int> > >, stlp_std::priv::_NonLocalUnorderedMapTraitsT<stlp_std::pair<void* const, long unsigned int> > >, bool>::first’ does not have a move constructor or trivial copy constructor
In file included from ../stlport/stl/_hashtable.h:541:0,
from ../stlport/stl/_unordered_map.h:24,
from ../stlport/unordered_map:28,
from reachable.cc:17:
../stlport/stl/_hashtable.c:251:41: instantiated from ‘stlp_std::hashtable<_Val, _Key, _HF, _Traits, _ExK, _EqK, _All>::reference stlp_std::hashtable<_Val, _Key, _HF, _Traits, _ExK, _EqK, _All>::_M_insert(const value_type&) [with _Val = stlp_std::pair<void* const, long unsigned int>, _Key = void*, _HF = stlp_std::hash<void*>, _Traits = stlp_std::priv::_UnorderedMapTraitsT<stlp_std::pair<void* const, long unsigned int> >, _ExK = stlp_std::priv::_Select1st<stlp_std::pair<void* const, long unsigned int> >, _EqK = stlp_std::equal_to<void*>, _All = stlp_std::allocator<stlp_std::pair<void* const, long unsigned int> >, stlp_std::hashtable<_Val, _Key, _HF, _Traits, _ExK, _EqK, _All>::reference = stlp_std::pair<void* const, long unsigned int>&, stlp_std::hashtable<_Val, _Key, _HF, _Traits, _ExK, _EqK, _All>::value_type = stlp_std::pair<void* const, long unsigned int>]’
../stlport/stl/_unordered_map.h:130:22: instantiated from ‘_Tp& stlp_std::unordered_map<_Key, _Tp, _HashFcn, _EqualKey, _Alloc>::operator[](const _KT&) [with _KT = void*, _Key = void*, _Tp = long unsigned int, _HashFcn = stlp_std::hash<void*>, _EqualKey = stlp_std::equal_to<void*>, _Alloc = stlp_std::allocator<stlp_std::pair<void* const, long unsigned int> >]’
reachable.cc:45:27: instantiated from here
../stlport/stl/_hashtable.c:216:54: error: use of deleted function ‘stlp_std::pair<_T1, _T2>::pair(stlp_std::pair<_T1, _T2>&&) [with _T1 = stlp_std::priv::_Ht_iterator<stlp_std::priv::_Slist_iterator<stlp_std::pair<void* const, long unsigned int>, stlp_std::_Nonconst_traits<stlp_std::pair<void* const, long unsigned int> > >, stlp_std::priv::_NonLocalUnorderedMapTraitsT<stlp_std::pair<void* const, long unsigned int> > >, _T2 = bool, stlp_std::pair<_T1, _T2> = stlp_std::pair<stlp_std::priv::_Ht_iterator<stlp_std::priv::_Slist_iterator<stlp_std::pair<void* const, long unsigned int>, stlp_std::_Nonconst_traits<stlp_std::pair<void* const, long unsigned int> > >, stlp_std::priv::_NonLocalUnorderedMapTraitsT<stlp_std::pair<void* const, long unsigned int> > >, bool>]’
../stlport/stl/_hashtable.c:251:41: instantiated from ‘stlp_std::hashtable<_Val, _Key, _HF, _Traits, _ExK, _EqK, _All>::reference stlp_std::hashtable<_Val, _Key, _HF, _Traits, _ExK, _EqK, _All>::_M_insert(const value_type&) [with _Val = stlp_std::pair<void* const, long unsigned int>, _Key = void*, _HF = stlp_std::hash<void*>, _Traits = stlp_std::priv::_UnorderedMapTraitsT<stlp_std::pair<void* const, long unsigned int> >, _ExK = stlp_std::priv::_Select1st<stlp_std::pair<void* const, long unsigned int> >, _EqK = stlp_std::equal_to<void*>, _All = stlp_std::allocator<stlp_std::pair<void* const, long unsigned int> >, stlp_std::hashtable<_Val, _Key, _HF, _Traits, _ExK, _EqK, _All>::reference = stlp_std::pair<void* const, long unsigned int>&, stlp_std::hashtable<_Val, _Key, _HF, _Traits, _ExK, _EqK, _All>::value_type = stlp_std::pair<void* const, long unsigned int>]’
../stlport/stl/_unordered_map.h:130:22: instantiated from ‘_Tp& stlp_std::unordered_map<_Key, _Tp, _HashFcn, _EqualKey, _Alloc>::operator[](const _KT&) [with _KT = void*, _Key = void*, _Tp = long unsigned int, _HashFcn = stlp_std::hash<void*>, _EqualKey = stlp_std::equal_to<void*>, _Alloc = stlp_std::allocator<stlp_std::pair<void* const, long unsigned int> >]’
reachable.cc:45:27: instantiated from here
../stlport/stl/_hashtable.c:219:67: error: use of deleted function ‘stlp_std::pair<_T1, _T2>::pair(stlp_std::pair<_T1, _T2>&&) [with _T1 = stlp_std::priv::_Ht_iterator<stlp_std::priv::_Slist_iterator<stlp_std::pair<void* const, long unsigned int>, stlp_std::_Nonconst_traits<stlp_std::pair<void* const, long unsigned int> > >, stlp_std::priv::_NonLocalUnorderedMapTraitsT<stlp_std::pair<void* const, long unsigned int> > >, _T2 = bool, stlp_std::pair<_T1, _T2> = stlp_std::pair<stlp_std::priv::_Ht_iterator<stlp_std::priv::_Slist_iterator<stlp_std::pair<void* const, long unsigned int>, stlp_std::_Nonconst_traits<stlp_std::pair<void* const, long unsigned int> > >, stlp_std::priv::_NonLocalUnorderedMapTraitsT<stlp_std::pair<void* const, long unsigned int> > >, bool>]’
make[1]: *** [obj/gcc/so/reachable.o] Error 1
make: *** [release-shared] Error 2
It turns out the source I got my copy of STLPort from, git://stlport.git.sourceforge.net/gitroot/stlport/stlport, is much more bleeding edge than I thought. If I grab the stable build from SourceForge it compiles fine.