I understand that a class class needs at least one virtual function defined in a source file (out of line), otherwise the vtable will need to be inserted into every object file.
I have the following situation:
//foo.cpp
struct Foo {
virtual int Bar() { return 1; }
virtual ~Foo() = default;
};
The clang code model in Qt Creator (4.5.2) emits a -Wweak-table warning for Foo.
Strictly speaking the warning is correct, as the vtable will be included in every translation unit. Practically, it's worthless because either way the vtable is only emitted in foo.o anyway.
How can I disable -Wweak-vtables only for classes defined in a source file?