mirror of git://gcc.gnu.org/git/gcc.git
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
|
|
@ -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>
|
2017-02-13 H.J. Lu <hongjiu.lu@intel.com>
|
||||||
|
|
||||||
PR libstdc++/79348
|
PR libstdc++/79348
|
||||||
|
|
|
||||||
|
|
@ -1263,7 +1263,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||||
__throw_bad_variant_access("Unexpected index");
|
__throw_bad_variant_access("Unexpected index");
|
||||||
|
|
||||||
using _Result_type =
|
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<
|
constexpr auto& __vtable = __detail::__variant::__gen_vtable<
|
||||||
_Result_type, _Visitor&&, _Variants&&...>::_S_vtable;
|
_Result_type, _Visitor&&, _Variants&&...>::_S_vtable;
|
||||||
|
|
|
||||||
|
|
@ -291,6 +291,12 @@ void test_visit()
|
||||||
};
|
};
|
||||||
static_assert(visit(Visitor(), variant<int, nonliteral>(0)), "");
|
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()
|
void test_constexpr()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue