Closed
Description
Reproducer:
// layer1.cppm
export module foo:layer1;
struct Fruit {
virtual ~Fruit() = default;
virtual void eval() = 0;
};
struct Banana : public Fruit {
Banana() {}
void eval() override;
};
// layer2.cppm
export module foo:layer2;
import :layer1;
export void layer2_fun() {
Banana *b = new Banana();
b->eval();
}
void Banana::eval() {
}
Compiler layer2.cppm with:
clang++ -std=c++20 layer1.cppm --precompile -o foo-layer1.pcm
clang++ -std=c++20 layer2.cppm -fprebuilt-module-path=. -S -emit-llvm -o -
Then we can't see anything about the definition of virtual table. This violates the itanium ABI 5.2.3:
The virtual table for a class is emitted in the same object containing the definition of its key function, i.e. the first non-pure virtual function that is not inline at the point of class definition.