Issue 93987
Summary C++ module with reduced BMI causes undefined vtable error
Labels
Assignees
Reporter rnikander
    Two simple files. If I compile with reduced BMI, I get a linker error.

`foo.cppm`:
```
export module foo_mod;

import std;

export struct Foo {
    virtual ~Foo() {}
    void bar() {
        std::cout << "In Foo::bar()\n";
 }
};
```

`main.cc`:
```
import foo_mod;
int main() {
    Foo foo;
    foo.bar();
}
```

If I precompile and compile `foo.cppm` normally, it all runs. If I use the reduced BMI method, passing the extra args to produce the second PCM: `-fexperimental-modules-reduced-bmi -fmodule-output=foo.red.pcm`, then I end up with this error when linking:

```
Undefined symbols for architecture x86_64:
  "vtable for Foo@foo_mod", referenced from:
 Foo@foo_mod::Foo() in main.o
   NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
```

_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to