llvm-project/clang/test/SemaCXX/warn-suggest-override.cpp
LoS e33f456ae5
Fixed some warn-override tests in SemaCXX (#122680)
The `.cpp` extension have been added to test files, so that they can be
runned. Besides, the `warn-suggest-override.cpp` tests have been fixed.

---------

Co-authored-by: LoS <aurumpuro@gmail.com>
2025-01-15 12:26:36 +01:00

40 lines
824 B
C++

// RUN: %clang_cc1 -fsyntax-only -std=c++11 %s -verify -Wsuggest-override
struct A {
~A();
void run();
};
struct B : public A {
~B();
void run();
};
struct C {
virtual void run(); // expected-note 2{{overridden virtual function is here}}
virtual ~C();
};
struct D : public C {
void run();
// expected-warning@-1 {{'run' overrides a member function but is not marked 'override'}}
~D();
};
struct E : public C {
virtual void run();
// expected-warning@-1 {{'run' overrides a member function but is not marked 'override'}}
virtual ~E();
};
struct F : public C {
void run() override;
~F() override;
};
struct G : public C { // expected-note {{mark 'G' as 'final'}}
void run() final;
~G() final;
// expected-warning@-1 {{class with destructor marked 'final' cannot be inherited from}}
};