re PR libstdc++/79513 (std::visit doesn't handle references)
PR libstdc++/79513 * include/std/variant (visit()): Forward variant types to the return type detection code. * testsuite/20_util/variant/compile.cc: Add test cases. From-SVN: r245474
This commit is contained in:
parent
fdbb46228f
commit
7d5abe42c2
3 changed files with 15 additions and 1 deletions
|
@ -1,3 +1,10 @@
|
|||
2017-02-15 Tim Shen <timshen@google.com>
|
||||
|
||||
PR libstdc++/79513
|
||||
* include/std/variant (visit()): Forward variant types to the return
|
||||
type detection code.
|
||||
* testsuite/20_util/variant/compile.cc: Add test cases.
|
||||
|
||||
2017-02-13 H.J. Lu <hongjiu.lu@intel.com>
|
||||
|
||||
PR libstdc++/79348
|
||||
|
|
|
@ -1263,7 +1263,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
|||
__throw_bad_variant_access("Unexpected index");
|
||||
|
||||
using _Result_type =
|
||||
decltype(std::forward<_Visitor>(__visitor)(get<0>(__variants)...));
|
||||
decltype(std::forward<_Visitor>(__visitor)(
|
||||
get<0>(std::forward<_Variants>(__variants))...));
|
||||
|
||||
constexpr auto& __vtable = __detail::__variant::__gen_vtable<
|
||||
_Result_type, _Visitor&&, _Variants&&...>::_S_vtable;
|
||||
|
|
|
@ -291,6 +291,12 @@ void test_visit()
|
|||
};
|
||||
static_assert(visit(Visitor(), variant<int, nonliteral>(0)), "");
|
||||
}
|
||||
// PR libstdc++/79513
|
||||
{
|
||||
std::variant<int> v [[gnu::unused]] (5);
|
||||
std::visit([](int&){}, v);
|
||||
std::visit([](int&&){}, std::move(v));
|
||||
}
|
||||
}
|
||||
|
||||
void test_constexpr()
|
||||
|
|
Loading…
Add table
Reference in a new issue