File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -121,8 +121,8 @@ namespace xtl
121121 static inline R forward (const T& r)
122122 {
123123 R ret;
124- std::copy_n ( std::begin (r), std::size (r), std::begin (ret));
125- // std::copy (std::begin(r), std::end(r ), std::begin(ret));
124+ // We can not use std::copy here because it gives an array-bounds warning with GCC
125+ std::copy_n (std::begin (r), std::size (ret ), std::begin (ret));
126126 return ret;
127127 }
128128 };
Original file line number Diff line number Diff line change @@ -39,14 +39,24 @@ namespace xtl
3939 return result (xtl::forward_sequence<shape_type, T>(arg));
4040 }
4141
42+ template <class T >
43+ auto test_data (T&& arg)
44+ {
45+ using shape_type = std::array<int , 1 >;
46+ shape_type a = xtl::forward_sequence<shape_type, T>(arg);
47+ return a;
48+ }
49+
4250 TEST (xsequence, forward_type)
4351 {
4452 std::array<int , 2 > a;
45- std::vector<int > c;
53+ std::vector<int > c (2 );
54+
4655 EXPECT_TRUE (test (std::move (a)));
4756 EXPECT_FALSE (test (a));
4857 EXPECT_TRUE (test (c));
4958 EXPECT_TRUE (test (std::move (c)));
59+ EXPECT_EQ (test_data (c)[0 ], 0 );
5060 }
5161
5262 template <class R , class T >
You can’t perform that action at this time.
0 commit comments