https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80737

TC <rs2740 at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rs2740 at gmail dot com

--- Comment #1 from TC <rs2740 at gmail dot com> ---
#include <variant>
#include <any>

std::variant<std::any> a, b(a);

In file included from main.cpp:1:0:
/usr/local/include/c++/7.1.0/variant: In instantiation of 'struct
std::__detail::__variant::__accepted_index<std::variant<std::any>&,
std::variant<std::any>, void>':
/usr/local/include/c++/7.1.0/variant:911:26:   required from 'constexpr const
size_t std::variant<std::any>::__accepted_index<std::variant<std::any>&>'
/usr/local/include/c++/7.1.0/variant:940:6:   required by substitution of
'template<class _Tp, class> constexpr std::variant<std::any>::variant(_Tp&&)
[with _Tp = std::variant<std::any>&; <template-parameter-1-2> = <missing>]'
main.cpp:4:30:   required from here
/usr/local/include/c++/7.1.0/variant:559:49: error: no matching function for
call to
'std::__detail::__variant::__overload_set<std::any>::_S_fun(std::variant<std::any>&)'
       decltype(__overload_set<_Types...>::_S_fun(std::declval<_Tp>()),
                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
/usr/local/include/c++/7.1.0/variant:541:58: note: candidate: static
std::integral_constant<long unsigned int, sizeof... (_Rest)>
std::__detail::__variant::__overload_set<_First, _Rest ...>::_S_fun(_First)
[with _First = std::any; _Rest = {}]
       static integral_constant<size_t, sizeof...(_Rest)> _S_fun(_First);
                                                          ^~~~~~
/usr/local/include/c++/7.1.0/variant:541:58: note:   no known conversion for
argument 1 from 'std::variant<std::any>' to 'std::any'
/usr/local/include/c++/7.1.0/variant:535:19: note: candidate: static void
std::__detail::__variant::__overload_set<_Types>::_S_fun() [with _Types = {}]
     { static void _S_fun(); };
                   ^~~~~~
/usr/local/include/c++/7.1.0/variant:535:19: note:   candidate expects 0
arguments, 1 provided
/usr/local/include/c++/7.1.0/variant:559:49: error: no matching function for
call to
'std::__detail::__variant::__overload_set<std::any>::_S_fun(std::variant<std::any>&)'
       decltype(__overload_set<_Types...>::_S_fun(std::declval<_Tp>()),
                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
/usr/local/include/c++/7.1.0/variant:541:58: note: candidate: static
std::integral_constant<long unsigned int, sizeof... (_Rest)>
std::__detail::__variant::__overload_set<_First, _Rest ...>::_S_fun(_First)
[with _First = std::any; _Rest = {}]
       static integral_constant<size_t, sizeof...(_Rest)> _S_fun(_First);
                                                          ^~~~~~
/usr/local/include/c++/7.1.0/variant:541:58: note:   no known conversion for
argument 1 from 'std::variant<std::any>' to 'std::any'
/usr/local/include/c++/7.1.0/variant:535:19: note: candidate: static void
std::__detail::__variant::__overload_set<_Types>::_S_fun() [with _Types = {}]
     { static void _S_fun(); };
                   ^~~~~~
/usr/local/include/c++/7.1.0/variant:535:19: note:   candidate expects 0
arguments, 1 provided
/usr/local/include/c++/7.1.0/variant:559:49: error: no matching function for
call to
'std::__detail::__variant::__overload_set<std::any>::_S_fun(std::variant<std::any>&)'
       decltype(__overload_set<_Types...>::_S_fun(std::declval<_Tp>()),
                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
/usr/local/include/c++/7.1.0/variant:541:58: note: candidate: static
std::integral_constant<long unsigned int, sizeof... (_Rest)>
std::__detail::__variant::__overload_set<_First, _Rest ...>::_S_fun(_First)
[with _First = std::any; _Rest = {}]
       static integral_constant<size_t, sizeof...(_Rest)> _S_fun(_First);
                                                          ^~~~~~
/usr/local/include/c++/7.1.0/variant:541:58: note:   no known conversion for
argument 1 from 'std::variant<std::any>' to 'std::any'
/usr/local/include/c++/7.1.0/variant:535:19: note: candidate: static void
std::__detail::__variant::__overload_set<_Types>::_S_fun() [with _Types = {}]
     { static void _S_fun(); };
                   ^~~~~~
/usr/local/include/c++/7.1.0/variant:535:19: note:   candidate expects 0
arguments, 1 provided
/usr/local/include/c++/7.1.0/variant: In instantiation of 'constexpr const
size_t std::__detail::__variant::__accepted_index<std::variant<std::any>&,
std::variant<std::any>, void>::value':
/usr/local/include/c++/7.1.0/variant:911:26:   required from 'constexpr const
size_t std::variant<std::any>::__accepted_index<std::variant<std::any>&>'
/usr/local/include/c++/7.1.0/variant:940:6:   required by substitution of
'template<class _Tp, class> constexpr std::variant<std::any>::variant(_Tp&&)
[with _Tp = std::variant<std::any>&; <template-parameter-1-2> = <missing>]'
main.cpp:4:30:   required from here
/usr/local/include/c++/7.1.0/variant:564:12: error: no matching function for
call to
'std::__detail::__variant::__overload_set<std::any>::_S_fun(std::variant<std::any>&)'
  - decltype(__overload_set<_Types...>::
             ~~~~~~~~~~~~~~~~~~~~~~~~~~~
      _S_fun(std::declval<_Tp>()))::value;
      ~~~~~~^~~~~~~~~~~~~~~~~~~~~
/usr/local/include/c++/7.1.0/variant:541:58: note: candidate: static
std::integral_constant<long unsigned int, sizeof... (_Rest)>
std::__detail::__variant::__overload_set<_First, _Rest ...>::_S_fun(_First)
[with _First = std::any; _Rest = {}]
       static integral_constant<size_t, sizeof...(_Rest)> _S_fun(_First);
                                                          ^~~~~~
/usr/local/include/c++/7.1.0/variant:541:58: note:   no known conversion for
argument 1 from 'std::variant<std::any>' to 'std::any'
/usr/local/include/c++/7.1.0/variant:535:19: note: candidate: static void
std::__detail::__variant::__overload_set<_Types>::_S_fun() [with _Types = {}]
     { static void _S_fun(); };
                   ^~~~~~
/usr/local/include/c++/7.1.0/variant:535:19: note:   candidate expects 0
arguments, 1 provided


Looks like the constraint on the convert-everything constructor needs to check
for is_same<decay_t<_Tp>, variant> first and short circuit if that's true.

Reply via email to