Author
anonymous
almost 7 years ago
Language
C++
Compiler
gcc 8.2.0
Options
Warnings
Don't Use Boost
C++17
-pedantic
Author
anonymous
almost 7 years ago
$ g++ prog.cc -Wall -Wextra -std=c++17 -pedantic
prog.cc: In function 'std::__cxx11::string bar(foo)':
prog.cc:11:29: error: no matching function for call to 'get<fi>(const foo&)'
auto ff = std::get<fi>(f);
^
In file included from /opt/wandbox/gcc-8.2.0/include/c++/8.2.0/variant:37,
from prog.cc:2:
/opt/wandbox/gcc-8.2.0/include/c++/8.2.0/utility:216:5: note: candidate: 'template<long unsigned int _Int, class _Tp1, class _Tp2> constexpr typename std::tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type& std::get(std::pair<_Tp1, _Tp2>&)'
get(std::pair<_Tp1, _Tp2>& __in) noexcept
^~~
/opt/wandbox/gcc-8.2.0/include/c++/8.2.0/utility:216:5: note: template argument deduction/substitution failed:
prog.cc:11:29: error: the value of 'fi' is not usable in a constant expression
auto ff = std::get<fi>(f);
^
prog.cc:10:23: note: 'fi' was not initialized with a constant expression
const std::size_t fi = f.index();
^~
prog.cc:11:29: note: in template argument for type 'long unsigned int'
auto ff = std::get<fi>(f);
^
In file included from /opt/wandbox/gcc-8.2.0/include/c++/8.2.0/variant:37,
from prog.cc:2:
/opt/wandbox/gcc-8.2.0/include/c++/8.2.0/utility:221:5: note: candidate: 'template<long unsigned int _Int, class _Tp1, class _Tp2> constexpr typename std::tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type&& std::get(std::pair<_Tp1, _Tp2>&&)'
get(std::pair<_Tp1, _Tp2>&& __in) noexcept
^~~
/opt/wandbox/gcc-8.2.0/include/c++/8.2.0/utility:221:5: note: template argument deduction/substitution failed:
prog.cc:11:29: error: the value of 'fi' is not usable in a constant expression
auto ff = std::get<fi>(f);
^
prog.cc:10:23: note: 'fi' was not initialized with a constant expression
const std::size_t fi = f.index();
^~
prog.cc:11:29: note: in template argument for type 'long unsigned int'
auto ff = std::get<fi>(f);
^
In file included from /opt/wandbox/gcc-8.2.0/include/c++/8.2.0/variant:37,
from prog.cc:2:
/opt/wandbox/gcc-8.2.0/include/c++/8.2.0/utility:226:5: note: candidate: 'template<long unsigned int _Int, class _Tp1, class _Tp2> constexpr const typename std::tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type& std::get(const std::pair<_Tp1, _Tp2>&)'
get(const std::pair<_Tp1, _Tp2>& __in) noexcept
^~~
/opt/wandbox/gcc-8.2.0/include/c++/8.2.0/utility:226:5: note: template argument deduction/substitution failed:
prog.cc:11:29: error: the value of 'fi' is not usable in a constant expression
auto ff = std::get<fi>(f);
^
prog.cc:10:23: note: 'fi' was not initialized with a constant expression
const std::size_t fi = f.index();
^~
prog.cc:11:29: note: in template argument for type 'long unsigned int'
auto ff = std::get<fi>(f);
^
In file included from /opt/wandbox/gcc-8.2.0/include/c++/8.2.0/variant:37,
from prog.cc:2:
/opt/wandbox/gcc-8.2.0/include/c++/8.2.0/utility:231:5: note: candidate: 'template<long unsigned int _Int, class _Tp1, class _Tp2> constexpr const typename std::tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type&& std::get(const std::pair<_Tp1, _Tp2>&&)'
get(const std::pair<_Tp1, _Tp2>&& __in) noexcept
^~~
/opt/wandbox/gcc-8.2.0/include/c++/8.2.0/utility:231:5: note: template argument deduction/substitution failed:
prog.cc:11:29: error: the value of 'fi' is not usable in a constant expression
auto ff = std::get<fi>(f);
^
prog.cc:10:23: note: 'fi' was not initialized with a constant expression
const std::size_t fi = f.index();
^~
prog.cc:11:29: note: in template argument for type 'long unsigned int'
auto ff = std::get<fi>(f);
^
In file included from /opt/wandbox/gcc-8.2.0/include/c++/8.2.0/variant:37,
from prog.cc:2:
/opt/wandbox/gcc-8.2.0/include/c++/8.2.0/utility:240:5: note: candidate: 'template<class _Tp, class _Up> constexpr _Tp& std::get(std::pair<_T1, _T2>&)'
get(pair<_Tp, _Up>& __p) noexcept
^~~
/opt/wandbox/gcc-8.2.0/include/c++/8.2.0/utility:240:5: note: template argument deduction/substitution failed:
/opt/wandbox/gcc-8.2.0/include/c++/8.2.0/utility:245:5: note: candidate: 'template<class _Tp, class _Up> constexpr const _Tp& std::get(const std::pair<_T1, _T2>&)'
get(const pair<_Tp, _Up>& __p) noexcept
^~~
/opt/wandbox/gcc-8.2.0/include/c++/8.2.0/utility:245:5: note: template argument deduction/substitution failed:
/opt/wandbox/gcc-8.2.0/include/c++/8.2.0/utility:250:5: note: candidate: 'template<class _Tp, class _Up> constexpr _Tp&& std::get(std::pair<_T1, _T2>&&)'
get(pair<_Tp, _Up>&& __p) noexcept
^~~
/opt/wandbox/gcc-8.2.0/include/c++/8.2.0/utility:250:5: note: template argument deduction/substitution failed:
/opt/wandbox/gcc-8.2.0/include/c++/8.2.0/utility:255:5: note: candidate: 'template<class _Tp, class _Up> constexpr const _Tp&& std::get(const std::pair<_T1, _T2>&&)'
get(const pair<_Tp, _Up>&& __p) noexcept
^~~
/opt/wandbox/gcc-8.2.0/include/c++/8.2.0/utility:255:5: note: template argument deduction/substitution failed:
/opt/wandbox/gcc-8.2.0/include/c++/8.2.0/utility:260:5: note: candidate: 'template<class _Tp, class _Up> constexpr _Tp& std::get(std::pair<_Up, _Tp>&)'
get(pair<_Up, _Tp>& __p) noexcept
^~~
/opt/wandbox/gcc-8.2.0/include/c++/8.2.0/utility:260:5: note: template argument deduction/substitution failed:
/opt/wandbox/gcc-8.2.0/include/c++/8.2.0/utility:265:5: note: candidate: 'template<class _Tp, class _Up> constexpr const _Tp& std::get(const std::pair<_Up, _Tp>&)'
get(const pair<_Up, _Tp>& __p) noexcept
^~~
/opt/wandbox/gcc-8.2.0/include/c++/8.2.0/utility:265:5: note: template argument deduction/substitution failed:
/opt/wandbox/gcc-8.2.0/include/c++/8.2.0/utility:270:5: note: candidate: 'template<class _Tp, class _Up> constexpr _Tp&& std::get(std::pair<_Up, _Tp>&&)'
get(pair<_Up, _Tp>&& __p) noexcept
^~~
/opt/wandbox/gcc-8.2.0/include/c++/8.2.0/utility:270:5: note: template argument deduction/substitution failed:
/opt/wandbox/gcc-8.2.0/include/c++/8.2.0/utility:275:5: note: candidate: 'template<class _Tp, class _Up> constexpr const _Tp&& std::get(const std::pair<_Up, _Tp>&&)'
get(const pair<_Up, _Tp>&& __p) noexcept
^~~
/opt/wandbox/gcc-8.2.0/include/c++/8.2.0/utility:275:5: note: template argument deduction/substitution failed:
In file included from prog.cc:2:
/opt/wandbox/gcc-8.2.0/include/c++/8.2.0/variant:1340:5: note: candidate: 'template<long unsigned int _Np, class ... _Types> constexpr std::variant_alternative_t<_Np, std::variant<_Types ...> >& std::get(std::variant<_Types ...>&)'
get(variant<_Types...>& __v)
^~~
/opt/wandbox/gcc-8.2.0/include/c++/8.2.0/variant:1340:5: note: template argument deduction/substitution failed:
prog.cc:11:29: error: the value of 'fi' is not usable in a constant expression
auto ff = std::get<fi>(f);
^
prog.cc:10:23: note: 'fi' was not initialized with a constant expression
const std::size_t fi = f.index();
^~
prog.cc:11:29: note: in template argument for type 'long unsigned int'
auto ff = std::get<fi>(f);
^
In file included from prog.cc:2:
/opt/wandbox/gcc-8.2.0/include/c++/8.2.0/variant:1351:5: note: candidate: 'template<long unsigned int _Np, class ... _Types> constexpr std::variant_alternative_t<_Np, std::variant<_Types ...> >&& std::get(std::variant<_Types ...>&&)'
get(variant<_Types...>&& __v)
^~~
/opt/wandbox/gcc-8.2.0/include/c++/8.2.0/variant:1351:5: note: template argument deduction/substitution failed:
prog.cc:11:29: error: the value of 'fi' is not usable in a constant expression
auto ff = std::get<fi>(f);
^
prog.cc:10:23: note: 'fi' was not initialized with a constant expression
const std::size_t fi = f.index();
^~
prog.cc:11:29: note: in template argument for type 'long unsigned int'
auto ff = std::get<fi>(f);
^
In file included from prog.cc:2:
/opt/wandbox/gcc-8.2.0/include/c++/8.2.0/variant:1362:5: note: candidate: 'template<long unsigned int _Np, class ... _Types> constexpr std::variant_alternative_t<_Np, std::variant<_Types ...> >& std::get(const std::variant<_Types ...>&)'
get(const variant<_Types...>& __v)
^~~
/opt/wandbox/gcc-8.2.0/include/c++/8.2.0/variant:1362:5: note: template argument deduction/substitution failed:
prog.cc:11:29: error: the value of 'fi' is not usable in a constant expression
auto ff = std::get<fi>(f);
^
prog.cc:10:23: note: 'fi' was not initialized with a constant expression
const std::size_t fi = f.index();
^~
prog.cc:11:29: note: in template argument for type 'long unsigned int'
auto ff = std::get<fi>(f);
^
In file included from prog.cc:2:
/opt/wandbox/gcc-8.2.0/include/c++/8.2.0/variant:1373:5: note: candidate: 'template<long unsigned int _Np, class ... _Types> constexpr std::variant_alternative_t<_Np, std::variant<_Types ...> >&& std::get(const std::variant<_Types ...>&&)'
get(const variant<_Types...>&& __v)
^~~
/opt/wandbox/gcc-8.2.0/include/c++/8.2.0/variant:1373:5: note: template argument deduction/substitution failed:
prog.cc:11:29: error: the value of 'fi' is not usable in a constant expression
auto ff = std::get<fi>(f);
^
prog.cc:10:23: note: 'fi' was not initialized with a constant expression
const std::size_t fi = f.index();
^~
prog.cc:11:29: note: in template argument for type 'long unsigned int'
auto ff = std::get<fi>(f);
^
In file included from prog.cc:2:
/opt/wandbox/gcc-8.2.0/include/c++/8.2.0/variant:892:27: note: candidate: 'template<class _Tp, class ... _Types> constexpr _Tp& std::get(std::variant<_Types ...>&)'
constexpr inline _Tp& get(variant<_Types...>& __v)
^~~
/opt/wandbox/gcc-8.2.0/include/c++/8.2.0/variant:892:27: note: template argument deduction/substitution failed:
/opt/wandbox/gcc-8.2.0/include/c++/8.2.0/variant:901:28: note: candidate: 'template<class _Tp, class ... _Types> constexpr _Tp&& std::get(std::variant<_Types ...>&&)'
constexpr inline _Tp&& get(variant<_Types...>&& __v)
^~~
/opt/wandbox/gcc-8.2.0/include/c++/8.2.0/variant:901:28: note: template argument deduction/substitution failed:
/opt/wandbox/gcc-8.2.0/include/c++/8.2.0/variant:911:33: note: candidate: 'template<class _Tp, class ... _Types> constexpr const _Tp& std::get(const std::variant<_Types ...>&)'
constexpr inline const _Tp& get(const variant<_Types...>& __v)
^~~
/opt/wandbox/gcc-8.2.0/include/c++/8.2.0/variant:911:33: note: template argument deduction/substitution failed:
/opt/wandbox/gcc-8.2.0/include/c++/8.2.0/variant:920:34: note: candidate: 'template<class _Tp, class ... _Types> constexpr const _Tp&& std::get(const std::variant<_Types ...>&&)'
constexpr inline const _Tp&& get(const variant<_Types...>&& __v)
^~~
/opt/wandbox/gcc-8.2.0/include/c++/8.2.0/variant:920:34: note: template argument deduction/substitution failed:
prog.cc: In function 'int main()':
prog.cc:22:14: error: no matching function for call to 'std::variant<int, int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >::variant(int)'
foo f( 0 );
^
In file included from prog.cc:2:
/opt/wandbox/gcc-8.2.0/include/c++/8.2.0/variant:1143:2: note: candidate: 'template<long unsigned int _Np, class _Up, class ... _Args, class> constexpr std::variant<_Types>::variant(std::in_place_index_t<_Np>, std::initializer_list<_Up>, _Args&& ...)'
variant(in_place_index_t<_Np>, initializer_list<_Up> __il,
^~~~~~~
/opt/wandbox/gcc-8.2.0/include/c++/8.2.0/variant:1143:2: note: template argument deduction/substitution failed:
prog.cc:22:14: note: mismatched types 'std::in_place_index_t<_Idx>' and 'int'
foo f( 0 );
^
In file included from prog.cc:2:
/opt/wandbox/gcc-8.2.0/include/c++/8.2.0/variant:1134:2: note: candidate: 'template<long unsigned int _Np, class ... _Args, class> constexpr std::variant<_Types>::variant(std::in_place_index_t<_Np>, _Args&& ...)'
variant(in_place_index_t<_Np>, _Args&&... __args)
^~~~~~~
/opt/wandbox/gcc-8.2.0/include/c++/8.2.0/variant:1134:2: note: template argument deduction/substitution failed:
prog.cc:22:14: note: mismatched types 'std::in_place_index_t<_Idx>' and 'int'
foo f( 0 );
^
In file included from prog.cc:2:
/opt/wandbox/gcc-8.2.0/include/c++/8.2.0/variant:1124:2: note: candidate: 'template<class _Tp, class _Up, class ... _Args, class> constexpr std::variant<_Types>::variant(std::in_place_type_t<_Tp>, std::initializer_list<_Up>, _Args&& ...)'
variant(in_place_type_t<_Tp>, initializer_list<_Up> __il,
^~~~~~~
/opt/wandbox/gcc-8.2.0/include/c++/8.2.0/variant:1124:2: note: template argument deduction/substitution failed:
prog.cc:22:14: note: mismatched types 'std::in_place_type_t<_Tp>' and 'int'
foo f( 0 );
^
In file included from prog.cc:2:
/opt/wandbox/gcc-8.2.0/include/c++/8.2.0/variant:1114:2: note: candidate: 'template<class _Tp, class ... _Args, class> constexpr std::variant<_Types>::variant(std::in_place_type_t<_Tp>, _Args&& ...)'
variant(in_place_type_t<_Tp>, _Args&&... __args)
^~~~~~~
/opt/wandbox/gcc-8.2.0/include/c++/8.2.0/variant:1114:2: note: template argument deduction/substitution failed:
prog.cc:22:14: note: mismatched types 'std::in_place_type_t<_Tp>' and 'int'
foo f( 0 );
^
In file included from prog.cc:2:
/opt/wandbox/gcc-8.2.0/include/c++/8.2.0/variant:1104:2: note: candidate: 'template<class _Tp, class, class, class> constexpr std::variant<_Types>::variant(_Tp&&)'
variant(_Tp&& __t)
^~~~~~~
/opt/wandbox/gcc-8.2.0/include/c++/8.2.0/variant:1104:2: note: template argument deduction/substitution failed:
/opt/wandbox/gcc-8.2.0/include/c++/8.2.0/variant:1093:7: note: candidate: 'std::variant<_Types>::variant(std::variant<_Types>&&) [with _Types = {int, int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >}]'
variant(variant&&) = default;
^~~~~~~
/opt/wandbox/gcc-8.2.0/include/c++/8.2.0/variant:1093:7: note: no known conversion for argument 1 from 'int' to 'std::variant<int, int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >&&'
/opt/wandbox/gcc-8.2.0/include/c++/8.2.0/variant:1092:7: note: candidate: 'std::variant<_Types>::variant(const std::variant<_Types>&) [with _Types = {int, int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >}]'
variant(const variant& __rhs) = default;
^~~~~~~
/opt/wandbox/gcc-8.2.0/include/c++/8.2.0/variant:1092:7: note: no known conversion for argument 1 from 'int' to 'const std::variant<int, int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >&'
/opt/wandbox/gcc-8.2.0/include/c++/8.2.0/variant:1091:7: note: candidate: 'constexpr std::variant<_Types>::variant() [with _Types = {int, int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >}]'
variant() = default;
^~~~~~~
/opt/wandbox/gcc-8.2.0/include/c++/8.2.0/variant:1091:7: note: candidate expects 0 arguments, 1 provided
Exit Code:
1