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 {
12721272 return arr[0 ] * 1000 + arr[1 ] * 100 + arr[2 ] * 10 + arr[3 ];
12731273 }
12741274 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}}
12751291}
12761292
12771293namespace Memcmp {
You can’t perform that action at this time.
0 commit comments