llvm-project/clang/test/SemaCXX/warn-suggest-destructor-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

28 lines
552 B
C++

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