<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/56310>56310</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Clang does not check for ODR violations when merging concepts from different modules
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang:frontend,
clang:modules,
concepts
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
ilya-biryukov
</td>
</tr>
</table>
<pre>
For this code:
```cpp
// module.map
module "foo" {
export *
header "foo.h"
}
module "bar" {
export *
header "bar.h"
}
// foo.h
template <class T> concept A = true;
// bar.h
template <class T> concept A = false;
// foo.cpp
// clang -std=c++20 -fmodules -fimplicit-modules -fmodule-map-file=module.map foo.cpp
#include "foo.h"
#include "bar.h"
template <class T> void foo() requires A<T> {}
void main() { foo<int>(); }
```
Expected: compiling the code produces an error as `concept A` is defined differently in two consumed modules, therefore it produces an ODR violation.
Actual: no error about ODR violation. Depending on the chosen concept a call to `foo<int>()` either succeeds or fails.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyVVNuOmzAQ_Rp4GQU5kMvuAw9J2H2tVPUHjD0Ed41NbZPd_H3HQDabKK1ayQJ7Zpg5c86Y2spz-WodhFZ5EFZiUuwSViVsl2zYtETfz5b8lRZ0Vg4as47P5ukMSZ431tITku1-8gDgR29dIN8OLqYWuUQ3h2ctvefs2-o-X83d_-Sj8Ef5bsBPNUdLwK7XPFCl4iA09x5-JMULkWAE9gGoQlFBcANRsn-Qaar275karv0fUkVQ9yxTHnOEhQ-SPhZJvqeVM1g0Ez2edoqqKqHC4mqadgvShtyaylVXte7LFMoIPUh8IMWN747Wv3V8skrCOAVPSf4MDn8NyhGwHYWNAVHKiy5jcMeVmaPJN35bHJQJFDyZiTG4SnmZya9YXj56FAGJpx1R3vVKK2IutDjOM_SOGBAEghtA52jWuYc41hd1aA80_BIbZVCCVE2DDk3QZ1AGwruNQvqhI99MdJIfYn6HjXUIKtzU-FZ9h5OyxI6yJpsg7kQYuI4Ajb2AqO0Q7oKhwh6NjPCtmTporUfzOUkcBNcago0NPOCKOkEVkYEfhECUHqhUw5X2WSrLQj4XzzwNKmgsD-OASUuojQ1UCcUb8e9uMXl4bwlAh-4YYc1APDTOdleqLsSkg9NlG0Lv429kHOQj4RnqjIShg9any2tBnP0k3eiovB8iqa_rTbFkaVtuGyaxWLFmUxf1crltNmwrWL5asQJ5g9tU8xq1L5M13Yp8vClUjyCZQPTFUSWBvng-Zft0zG1Ey7pKVZmzPGebgi3X-TJfZ6zmAmvCIJ9wvXrCZMWQJlVnEXlm3TF15dhEPRw9ObXywV-ddB_U0SCOACk_H0JrXan0mS9q5c7Dmz2lY9fl2PJvM9axsQ">