You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: test/testsizeof.cpp
+8-5Lines changed: 8 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -598,14 +598,17 @@ class TestSizeof : public TestFixture {
598
598
" void *data;\n"
599
599
"};\n"
600
600
"char f(struct FOO* foo) {\n"
601
-
" char x = *(foo[1].data + 1);\n"
602
-
" return x;\n"
603
-
"}\n"
601
+
" *(foo[1].data + 1) = 0;\n"
602
+
"}\n");
603
+
ASSERT_EQUALS("[test.cpp:5]: (portability) 'foo[1].data' is of type 'void *'. When using void pointers in calculations, the behaviour is undefined.\n", errout.str());
604
+
605
+
check("struct FOO {\n"
606
+
" void *data;\n"
607
+
"};\n"
604
608
"void f2(struct FOO* foo) {\n"
605
609
" (foo[0]).data++;\n"
606
610
"}");
607
-
TODO_ASSERT_EQUALS("[test.cpp:5]: (portability) 'foo[1].data' is of type 'void *'. When using void pointers in calculations, the behaviour is undefined.\n"
608
-
"[test.cpp:9]: (portability) 'foo[0].data' is of type 'void *'. When using void pointers in calculations, the behaviour is undefined.\n", "", errout.str());
611
+
ASSERT_EQUALS("[test.cpp:5]: (portability) '(foo[0]).data' is of type 'void *'. When using void pointers in calculations, the behaviour is undefined.\n", errout.str());
0 commit comments