<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/64211>64211</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
No viable conversion from const char* to std::string in modules
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
Pyzyryab
</td>
</tr>
</table>
<pre>
I have this type:
```
struct TestSuite {
std::string uuid;
std::vector<TestCase*> cases {};
TestResults results {};
TestSuite() = delete;
/**
* @short This ctr shouldn't exist, since {@link std::string} has a constructor
* for convert cstr to std::string
* @bug Clang16 under windows linking against libc++ with mingw,
* when the TestSuite new instance receives a const char* in a different file
* than the main file (in particular from a module), Clang refuses to compile
* saying that there's no viable ctr for TestSuite receiving a const char*
*/
constexpr explicit TestSuite(const char* uuid)
: uuid(std::move(uuid)) {}
constexpr explicit TestSuite(std::string uuid)
: uuid(std::move(uuid)) {}
TestSuite(const TestSuite& rhs) = delete;
TestSuite (TestSuite&& rhs) = delete;
friend bool operator==(const TestSuite& lhs, const TestSuite& rhs) {
return lhs.uuid == rhs.uuid;
}
};
```
In a regular cpp file, I can write:
```
TestSuite suite {"Some cstr"};
```
If I create a new instance of a `TestSuite` within a module partition, I receive:
```
no viable conversion from const char* to std::string
```
having the explicit constructor that takes a `std::string`.
### Env details
OS: Windows 11
thread-model: POSIX
clang++ --version: 16.0.5
triplet: pc-windows-gnu
stdlib: libc++
### Extra
I wasn't able to reproduce the problem under a Linux OS, but care, in Linux, I only have access to Clang's version `15.0.7-9`
I could provide more exact details if they're requested later, but I lost for the rest of today my access to the Windows environment.
By the way, you can find the full codebase here: https://github.com/Pyzyryab/Zero/commit/fc186f83dc573c8d5c1f9695ecda5407bf6ae247
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJysVt2O4jYUfhpzcwRKHEjggosZZpFGqrqrzkqteufYJ8Rdx6a2A0Ofvjp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