File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed
Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -2423,7 +2423,7 @@ void CheckClass::checkVirtualFunctionCallInConstructor()
24232423 continue ;
24242424 if (callstack.back ()->function ()->isPure ())
24252425 pureVirtualFunctionCallInConstructorError (scope->function , callstack, callstack.back ()->str ());
2426- else
2426+ else if (!callstack. back ()-> function ()-> hasFinalSpecifier ())
24272427 virtualFunctionCallInConstructorError (scope->function , callstack, callstack.back ()->str ());
24282428 }
24292429 }
Original file line number Diff line number Diff line change @@ -6968,6 +6968,17 @@ class TestClass : public TestFixture {
69686968 " A() { f(); }\n "
69696969 " };\n " );
69706970 ASSERT_EQUALS (" " , errout.str ());
6971+
6972+ checkVirtualFunctionCall (" class B {\n "
6973+ " public:"
6974+ " virtual void f() {}\n "
6975+ " };\n "
6976+ " class A : B {\n "
6977+ " public:"
6978+ " void f() override final {}\n "
6979+ " A() { f(); }\n "
6980+ " };\n " );
6981+ ASSERT_EQUALS (" " , errout.str ());
69716982 }
69726983
69736984 void pureVirtualFunctionCall () {
You can’t perform that action at this time.
0 commit comments