mirror of git://gcc.gnu.org/git/gcc.git
re PR libstdc++/65978 (missing constexpr on std::forward_as_tuple and std::tie (LWG issues 2275 and 2301))
PR libstdc++/65978 * include/std/tuple (forward_as_tuple, tie): Add constexpr. * testsuite/20_util/tuple/creation_functions/constexpr.cc: Uncomment and fix tests for forward_as_tuple and tie. From-SVN: r222719
This commit is contained in:
parent
58f270df25
commit
cb2ef49e83
|
|
@ -1,5 +1,10 @@
|
||||||
2015-05-02 Jonathan Wakely <jwakely@redhat.com>
|
2015-05-02 Jonathan Wakely <jwakely@redhat.com>
|
||||||
|
|
||||||
|
PR libstdc++/65978
|
||||||
|
* include/std/tuple (forward_as_tuple, tie): Add constexpr.
|
||||||
|
* testsuite/20_util/tuple/creation_functions/constexpr.cc: Uncomment
|
||||||
|
and fix tests for forward_as_tuple and tie.
|
||||||
|
|
||||||
* src/filesystem/ops.cc (last_write_time) [_GLIBCXX_USE_UTIMENSAT]:
|
* src/filesystem/ops.cc (last_write_time) [_GLIBCXX_USE_UTIMENSAT]:
|
||||||
Set timespec members explicitly instead of with a braced-init-list.
|
Set timespec members explicitly instead of with a braced-init-list.
|
||||||
[_GLIBCXX_HAVE_UTIME_H]: Use lambda to handle st_atime being a macro.
|
[_GLIBCXX_HAVE_UTIME_H]: Use lambda to handle st_atime being a macro.
|
||||||
|
|
|
||||||
|
|
@ -970,8 +970,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||||
return __result_type(std::forward<_Elements>(__args)...);
|
return __result_type(std::forward<_Elements>(__args)...);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// _GLIBCXX_RESOLVE_LIB_DEFECTS
|
||||||
|
// 2275. Why is forward_as_tuple not constexpr?
|
||||||
template<typename... _Elements>
|
template<typename... _Elements>
|
||||||
tuple<_Elements&&...>
|
constexpr tuple<_Elements&&...>
|
||||||
forward_as_tuple(_Elements&&... __args) noexcept
|
forward_as_tuple(_Elements&&... __args) noexcept
|
||||||
{ return tuple<_Elements&&...>(std::forward<_Elements>(__args)...); }
|
{ return tuple<_Elements&&...>(std::forward<_Elements>(__args)...); }
|
||||||
|
|
||||||
|
|
@ -1120,9 +1122,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||||
return __concater::_S_do(std::forward<_Tpls>(__tpls)...);
|
return __concater::_S_do(std::forward<_Tpls>(__tpls)...);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// _GLIBCXX_RESOLVE_LIB_DEFECTS
|
||||||
|
// 2301. Why is tie not constexpr?
|
||||||
/// tie
|
/// tie
|
||||||
template<typename... _Elements>
|
template<typename... _Elements>
|
||||||
inline tuple<_Elements&...>
|
constexpr tuple<_Elements&...>
|
||||||
tie(_Elements&... __args) noexcept
|
tie(_Elements&... __args) noexcept
|
||||||
{ return tuple<_Elements&...>(__args...); }
|
{ return tuple<_Elements&...>(__args...); }
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -45,49 +45,51 @@ test_make_tuple()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
// forward_as_tuple
|
// forward_as_tuple
|
||||||
void
|
void
|
||||||
test_forward_as_tuple()
|
test_forward_as_tuple()
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
typedef std::tuple<int, float> tuple_type;
|
static int i(22);
|
||||||
|
static float f(22.222);
|
||||||
|
typedef std::tuple<int&, float&&> tuple_type;
|
||||||
constexpr tuple_type p1 __attribute__((unused))
|
constexpr tuple_type p1 __attribute__((unused))
|
||||||
= std::forward_as_tuple(22, 22.222);
|
= std::forward_as_tuple(i, std::move(f));
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
typedef std::tuple<int, float, int> tuple_type;
|
static int i(22);
|
||||||
|
static float f(22.222);
|
||||||
|
static int ii(77799);
|
||||||
|
|
||||||
|
typedef std::tuple<int&, float&, int&&> tuple_type;
|
||||||
constexpr tuple_type p1 __attribute__((unused))
|
constexpr tuple_type p1 __attribute__((unused))
|
||||||
= std::forward_as_tuple(22, 22.222, 77799);
|
= std::forward_as_tuple(i, f, std::move(ii));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
// tie
|
// tie
|
||||||
void
|
void
|
||||||
test_tie()
|
test_tie()
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
int i(22);
|
static int i(22);
|
||||||
float f(22.222);
|
static float f(22.222);
|
||||||
typedef std::tuple<int, float> tuple_type;
|
typedef std::tuple<int&, float&> tuple_type;
|
||||||
constexpr tuple_type p1 __attribute__((unused))
|
constexpr tuple_type p1 __attribute__((unused))
|
||||||
= std::tie(i, f);
|
= std::tie(i, f);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
int i(22);
|
static int i(22);
|
||||||
float f(22.222);
|
static float f(22.222);
|
||||||
int ii(77799);
|
static const int ii(77799);
|
||||||
|
|
||||||
typedef std::tuple<int, float, int> tuple_type;
|
typedef std::tuple<int&, float&, const int&> tuple_type;
|
||||||
constexpr tuple_type p1 __attribute__((unused))
|
constexpr tuple_type p1 __attribute__((unused))
|
||||||
= std::tie(i, f, ii);
|
= std::tie(i, f, ii);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
// get
|
// get
|
||||||
void
|
void
|
||||||
|
|
@ -124,6 +126,8 @@ int
|
||||||
main()
|
main()
|
||||||
{
|
{
|
||||||
test_make_tuple();
|
test_make_tuple();
|
||||||
|
test_forward_as_tuple();
|
||||||
|
test_tie();
|
||||||
test_get();
|
test_get();
|
||||||
test_tuple_cat();
|
test_tuple_cat();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue