<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/62589>62589</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[modules][concepts] clang fails to correctly check constrained satisfaction when using modules
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
FabioFracassi
</td>
</tr>
</table>
<pre>
Consider the following (c++23) code:
```
auto str = std::string{"hello"};
auto s = std::basic_string_view{str};
```
this constructs a basic_string_view using CTAD and the C++23 range ctor. (In user code most people would probably use std::string_view{str}, but that is not the point here, I came across this when chasing the root cause for an issue in a formatter I wrote, and libc++ uses the above in its formatter implementation)
So far so good. This works as expected if I am using it in non module code. Now for the interesting part: if I try to import string/string_view/basic_string_view form a module
```
export module mystd;
export namespace std {
using std::string;
using std::string_view;
using std::basic_string_view;
}
```
it stops working failing with error: constraints not satisfied.
I have been able to fix this by also explicitly exporting some -at least in my estimation- unrelated operator overloads (comparisons and +/-)
CE link with complete code: https://godbolt.org/z/qYchnbqKM. (Check with `#define NO_WORKAROUND`) to see the error.
leaving aside the issue that these are standard types and that the exported operators would be needed in a proper std module,
AFAIU it should not be necessary to explicitly export more than the types/names directly involved (i.e. string and basic_string_view)
tested on clang/libc++ 16.0.x and trunk
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx8VduO2zgPfhrlhpggkScHX-Qihz_AoPhboNtisVcFLTOxtrLoSnQy2adfSPZ0MzO7BQIbjkiK34ESxmjPnmijFju1OEywl4bD5oiV5WNAk9YnFde3zZ59tDUFkIbgxM7x1fozKL02Su-U3ulC6RIM16SKrZod1OzluZyNv_yJvTBECaCKA0SpU3SxjRKsP6vVTmndkHOstFargyp291mvcyqM1nwbMr9dLF3Vahcl3Ke92Xt4SmMjGPZRQm8kAsK7StDHhG7_ZXsA9HUGvX_BCQH9mcAIh2ki4MlDHylk7NByF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