<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/93987>93987</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            C++ module with reduced BMI causes undefined vtable error
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          rnikander
      </td>
    </tr>
</table>

<pre>
    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.
```

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx8lE2P4jgQhn-NuZQSBYcAOeTQ0IvEYXb3MHseOXGFeNt2Rf7oj8v-9pVDCHSrNYCAuKpcb956YuG9uljEhlUHVj2vRAwDucZZ9SKsRLdqSX40P98IvDKjRuiVRp_DuYczdGRGpRHeVBjAoYwdSjj8ODN-hDNcMIAArewLOkDnyOWseGbF0_y9LXqivBtHw7YFK-_L82e6xPeRXABDMqbmRL8MSVYeHndSZsrx4WtgLvbBxS7AiQjYbk4AAHhVLkSh4b8TEeN7xuspvnt-SCEloRXuIbzE0mvq-cTKp45iAFYeWXkExvnZpnbX0FLOqqNlnC8iYWmV_izSPxuwLBqhbN51v_Fq9uGrScoGSMXf3UPypE9CH9bSVO6aF1mL1u_0TTiMDm9ECCsXOj4PGiw5I7T-SJCoAEJrcNHekIoeIQz4SBMYDAPJlD8mXO1lysD34AQId_EQCEZHqWCKeOzISvj7-IOVT6l91uP7iE4ZtEHo7AqTz-YeWWsUZP11NaMYxhhY-Zw0O5T52E188mPa28IZ0EqI4xX6MCh_ZRveUjTRruzlPqHvLPvHSuyVRQn-w7SkPfTkQLhuUAG7EB3C-377a7tZtoHE1GsQ7fQMuImtTXEbNOdJncMeHdpkWu_I3Gs_J09I3oFXdmIjp2X-f_7184_kmwCjrm7PjaOPaW5gUFg_Gd0r5wNYspmyWllcniiDpkUHfbRdUGRhEB4swXTbKq3k3xqzkk0p67IWK2zWu_Suqm25Ghq-F5t1zwu-F_u22u5Ey2VV1rKtebfua75SDS_4pqjK9Xq35psyX_O6lz1f913dVrLYsU2BRiida_1qcnKXlfI-YlOX9X630qJF7W9noGtSUtbGi2ebQisf_L0sqKCxOTJ-YPxwO5e-HoDQiejRQ1wmPXs4obKKTjdDCKNP0-Anxk8XFYbY5h0Zxk-p1_yTjY7-xS4wfpr0esZPV8mvDf8_AAD__6q3utI">