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/testclass.cpp
+72Lines changed: 72 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -7539,6 +7539,78 @@ class TestClass : public TestFixture {
7539
7539
" };\n"
7540
7540
"}\n");
7541
7541
ASSERT_EQUALS("[test.cpp:2] -> [test.cpp:6]: (style) The function 'f' overrides a function in a base class but is not marked with a 'override' specifier.\n", errout.str());
7542
+
7543
+
checkOverride("struct A {\n"
7544
+
" virtual void f(int);\n"
7545
+
"};\n"
7546
+
"struct D : A {\n"
7547
+
" void f(double);\n"
7548
+
"};\n");
7549
+
ASSERT_EQUALS("", errout.str());
7550
+
7551
+
checkOverride("struct A {\n"
7552
+
" virtual void f(int);\n"
7553
+
"};\n"
7554
+
"struct D : A {\n"
7555
+
" void f(int);\n"
7556
+
"};\n");
7557
+
ASSERT_EQUALS("[test.cpp:2] -> [test.cpp:5]: (style) The function 'f' overrides a function in a base class but is not marked with a 'override' specifier.\n", errout.str());
7558
+
7559
+
checkOverride("struct A {\n"
7560
+
" virtual void f(char, int);\n"
7561
+
"};\n"
7562
+
"struct D : A {\n"
7563
+
" void f(char, int);\n"
7564
+
"};\n");
7565
+
ASSERT_EQUALS("[test.cpp:2] -> [test.cpp:5]: (style) The function 'f' overrides a function in a base class but is not marked with a 'override' specifier.\n", errout.str());
7566
+
7567
+
checkOverride("struct A {\n"
7568
+
" virtual void f(char, int);\n"
7569
+
"};\n"
7570
+
"struct D : A {\n"
7571
+
" void f(char, double);\n"
7572
+
"};\n");
7573
+
ASSERT_EQUALS("", errout.str());
7574
+
7575
+
checkOverride("struct A {\n"
7576
+
" virtual void f(char, int);\n"
7577
+
"};\n"
7578
+
"struct D : A {\n"
7579
+
" void f(char c = '\\0', double);\n"
7580
+
"};\n");
7581
+
ASSERT_EQUALS("", errout.str());
7582
+
7583
+
checkOverride("struct A {\n"
7584
+
" virtual void f(char, int);\n"
7585
+
"};\n"
7586
+
"struct D : A {\n"
7587
+
" void f(char c = '\\0', int);\n"
7588
+
"};\n");
7589
+
ASSERT_EQUALS("[test.cpp:2] -> [test.cpp:5]: (style) The function 'f' overrides a function in a base class but is not marked with a 'override' specifier.\n", errout.str());
7590
+
7591
+
checkOverride("struct A {\n"
7592
+
" virtual void f(char c, std::vector<int>);\n"
7593
+
"};\n"
7594
+
"struct D : A {\n"
7595
+
" void f(char c, std::vector<double>);\n"
7596
+
"};\n");
7597
+
ASSERT_EQUALS("", errout.str());
7598
+
7599
+
checkOverride("struct A {\n"
7600
+
" virtual void f(char c, std::vector<int>);\n"
7601
+
"};\n"
7602
+
"struct D : A {\n"
7603
+
" void f(char c, std::set<int>);\n"
7604
+
"};\n");
7605
+
ASSERT_EQUALS("", errout.str());
7606
+
7607
+
checkOverride("struct A {\n"
7608
+
" virtual void f(char c, std::vector<int> v);\n"
7609
+
"};\n"
7610
+
"struct D : A {\n"
7611
+
" void f(char c, std::vector<int> w = {});\n"
7612
+
"};\n");
7613
+
TODO_ASSERT_EQUALS("[test.cpp:2] -> [test.cpp:5]: (style) The function 'f' overrides a function in a base class but is not marked with a 'override' specifier.\n", "", errout.str());
0 commit comments