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

    <tr>
        <th>Summary</th>
        <td>
            Defaulted copy constructor behaves differently, sometimes, when struct is in module
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

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

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

<pre>
    The code below declares two structs `Thing` and `Thing2`. Their only difference should be that former is in a module. As the output shows, the raw `int` field in `t1` is not initialized with a copy, as expected. But this behavior goes away when I remove the last line of `main`, which calls `format(...)`, so I really don't get what's happening.

I tried the same code with MSVC and it behaves as I'd expect, copying and printing all `1`'s. 

`main.cc`
```

#include <iostream>
#include <format>

import bug1mod;

using std::cout; using std::endl; using std::format;

struct Thing2 {
 static const Thing2 One;
    explicit Thing2(int raw) :raw(raw) {  }
 int raw;  
};

const Thing2 Thing2::One = Thing2(1);

int main() {
    Thing t1 = Thing::One;
    cout << "t1.raw = " << t1.raw << ", Thing::One.raw = " << Thing::One.raw << endl;

    Thing2 t2 = Thing2::One;
    cout << "t2.raw = " << t2.raw << ", Thing2::One.raw = " << Thing2::One.raw << endl;

    cout << format("what?\n");
}
```

`mod.ixx` 
```
export module bug1mod;

export struct Thing {
    static const Thing One;
 explicit Thing(int raw) :raw(raw) { }
    int raw;
};

const Thing Thing::One = Thing(1);
```

The output on my macOS laptop, with latest clang:

```text
t1.raw = 0, Thing::One.raw = 1
t2.raw = 1, Thing2::One.raw = 1
what?
```


</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyMVk1vqzoT_jXOZnQQmAbCgkXbvJG6eNXFqe7ewZPge42N7KFp7q-_soGE9KQ9R0Ikns9nxs_YCO_V0SDWbP3E1tuVGKi1rnZG_SOMRLfaW3mu31qExkqEPWp7AomNFg490MmCJzc05IEV6VurzJEV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