6

Object.hpp:

class Object
{  
public:
    virtual ~Object();
};

Object.cpp:

#include "Object.hpp"

Object::~Object()
{
}

Let's compile it:

>clang++ -v
clang version 3.9.0 (branches/release_39)
Target: x86_64-pc-windows-msvc
Thread model: posix

>clang++ -Weverything -c Object.cpp
In file included from Object.cpp:1:
./Object.hpp:1:7: warning: 'Object' has no out-of-line virtual method definitions;
its vtable will be emitted in every translation unit [-Wweak-vtables]
class Object
      ^
1 warning generated.

But Object does have an out-of-line virtual method, so why is Clang producing this warning?

Tom
  • 61
  • 3

0 Answers0