File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -1272,6 +1272,22 @@ namespace BuiltinMemcpy {
1272
1272
return arr[0 ] * 1000 + arr[1 ] * 100 + arr[2 ] * 10 + arr[3 ];
1273
1273
}
1274
1274
static_assert (test_incomplete_array_type() == 1234 ); // both-error {{constant}} both-note {{in call}}
1275
+
1276
+
1277
+ // / FIXME: memmove needs to support overlapping memory regions.
1278
+ constexpr bool memmoveOverlapping () {
1279
+ char s1[] {1 , 2 , 3 };
1280
+ __builtin_memmove (s1, s1 + 1 , 2 * sizeof (char ));
1281
+ // Now: 2, 3, 3
1282
+ bool Result1 = (s1[0 ] == 2 && s1[1 ] == 3 && s1[2 ]== 3 );
1283
+
1284
+ __builtin_memmove (s1 + 1 , s1, 2 * sizeof (char ));
1285
+ // Now: 2, 2, 3
1286
+ bool Result2 = (s1[0 ] == 2 && s1[1 ] == 2 && s1[2 ]== 3 );
1287
+
1288
+ return Result1 && Result2;
1289
+ }
1290
+ static_assert (memmoveOverlapping()); // expected-error {{failed}}
1275
1291
}
1276
1292
1277
1293
namespace Memcmp {
You can’t perform that action at this time.
0 commit comments