<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/79240>79240</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[RFC] [C++20] [Modules] Relax the ODR check for decls in global module fragment
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang:modules
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
ChuanqiXu9
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
ChuanqiXu9
</td>
</tr>
</table>
<pre>
The false positive ODR violation diagnostic for modules have been an annoying problem for a long time. We've received a lot of issue reports about it and I rarely see the reports saying the mechanism find real ODR violations. (a suspicious one may be https://github.com/llvm/llvm-project/issues/61643).
Then in a private chat with MSVC developer, he told me MSVC don't check ODR violations in the global module fragment. This is a surprise to me and I never thought we can proceed by this. I feel this may be a regression at first. But I feel it might make sense due to:
- Like I said before, there are a lot of false positive ODR violation diagnostic while the true positive diagnostics are much less.
- On the other hand, given that the things in the global module fragment are mostly from headers, it won't be a regression compared with the era before modules.
- It is really hard for the compiler to get ODR Hash correct in the GMF due to the complexity of headers and C++. An example may be https://github.com/llvm/llvm-project/issues/78850. While all of us love standard conforming implementation, sometimes it is really to get things right.
So I'd like to take the same strategy with MSVC to not check ODR violations in the global module fragment.
Given the fact that this is actually a regression on the standard conformance, I am not sure if people have different opinions.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJykVd1u4zYTfRr6ZrCCTMv2-sIX-YH3M_AFC2SDbm9H5EhkQ5EqSTnx2xdDy5tsUKBFF_APRA3PzJxzhsSUbO-J9mJ9K6S8MxP6P-3v005IKdb3C5yyCXH_tr5ogz7vnwxBhy4RjCHZbE8EX-8f4WSDw2yDB22x9yFlq6ALEYagJ0cJDJ4IWiIPyB8fztb3MMbQOhpKJIILvodsB6rgOwm5PRFEUmRPpMvbDKEDm9LE62OIOQG2YcpgM6DXcISIkdwZEhFk8xaVsGTjpYGUQW_TAJ31GiKh-7mBVIGQnxHS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