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

    <tr>
        <th>Summary</th>
        <td>
            Error when importing <string> and <iostream> in same file with c++-20 standard modules
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
      </td>
    </tr>

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

    <tr>
      <th>Reporter</th>
      <td>
          mls-m5
      </td>
    </tr>
</table>

<pre>
    I get a compilation error when trying to import `<string>` and `<iostream>` in the same file. Something seems to be off.

This is what I have tried this far. (based on instructions from [clang][1])
```bash
clang++-16 -std=c++20 -stdlib=libc++ -xc++-system-header --precompile "/usr/lib/llvm-16/include/c++/v1/iostream"  -o  "iostream.pcm" -Wno-pragma-system-header-outside-header -Wno-user-defined-literals 
clang++-16 -std=c++20 -stdlib=libc++ -xc++-system-header --precompile "/usr/lib/llvm-16/include/c++/v1/string"  -o  "string.pcm" -Wno-pragma-system-header-outside-header -Wno-user-defined-literals 
clang++-16 -std=c++20 -stdlib=libc++ "apa.cpp"  -fmodule-file="iostream.pcm" -fmodule-file="string.pcm"  -c -o  "apa.o" 
```

```c++
// apa.cpp
import <iostream>;
import <string>;

int print() {
    std::cout << "hello" << std::endl;
    return 10;
}

```

The error message I get is
```bash
In module '/usr/lib/llvm-16/include/c++/v1/iostream':
/usr/lib/llvm-16/bin/../include/c++/v1/string_view:301:5: error: 'std::basic_string_view<char>::basic_string_view' from module '/usr/lib/llvm-16/include/c++/v1/iostream' is not present in definition of 'std::string_view' in module '/usr/lib/llvm-16/include/c++/v1/string'
    basic_string_view(const _CharT* __s, size_type __len) _NOEXCEPT
    ^
/usr/lib/llvm-16/bin/../include/c++/v1/string_view:267:5
: note: definition has no member 'basic_string_view'
    basic_string_view {
    ^
In module '/usr/lib/llvm-16/include/c++/v1/iostream':
/usr/lib/llvm-16/bin/../include/c++/v1/string_view:295:5: error: 'std::basic_string_view<char>::basic_string_view' from module '/usr/lib/llvm-16/include/c++/v1/iostream' is not present in definition of 'std::string_view' in module '/usr/lib/llvm-16/include/c++/v1/string'
    basic_string_view(const basic_string_view&) _NOEXCEPT = default;
    ^
/usr/lib/llvm-16/bin/../include/c++/v1/string_view:267:5: note: definition has no member 'basic_string_view'
    basic_string_view {
    ^
In module '/usr/lib/llvm-16/include/c++/v1/iostream':
/usr/lib/llvm-16/bin/../include/c++/v1/string_view:292:5: error: 'std::basic_string_view<char>::basic_string_view' from module '/usr/lib/llvm-16/include/c++/v1/iostream' is not present in definition of 'std::string_view' in module '/usr/lib/llvm-16/include/c++/v1/string'
    basic_string_view() _NOEXCEPT : __data_ (nullptr), __size_(0) {}
    ^
/usr/lib/llvm-16/bin/../include/c++/v1/string_view:267:5: note: definition has no member 'basic_string_view'
    basic_string_view {
    ^
In module '/usr/lib/llvm-16/include/c++/v1/iostream':
/usr/lib/llvm-16/bin/../include/c++/v1/string_view:312:37: error: 'std::basic_string_view<char>::basic_string_view' from module '/usr/lib/llvm-16/include/c++/v1/iostream' is not present in definition of 'std::string_view' in module '/usr/lib/llvm-16/include/c++/v1/string'
    constexpr _LIBCPP_HIDE_FROM_ABI basic_string_view(_It __begin, _End __end)
                                    ^
/usr/lib/llvm-16/bin/../include/c++/v1/string_view:267:5: note: definition has no member 'basic_string_view'
    basic_string_view {
    ^
In module '/usr/lib/llvm-16/include/c++/v1/iostream':
/usr/lib/llvm-16/bin/../include/c++/v1/string_view:339:5: 
error: 'std::basic_string_view<char>::basic_string_view' from module '/usr/lib/llvm-16/include/c++/v1/iostream' is not present in definition of 'std::string_view' in module '/usr/lib/llvm-16/include/c++/v1/string'
    basic_string_view(const _CharT* __s)
    ^
...
```

I have also tried to compile the header units with
```bash
clang++-16 -std=c++20 -stdlib=libc++ -fmodule-header=system -xc++-header "iostream"  -o  "iostream.pcm" -Wno-pragma-system-header-outside-header -Wno-user-defined-literals 
build "string.pcm"
clang++-16 -std=c++20 -stdlib=libc++ -fmodule-header=system -xc++-header "string"  -o  "string.pcm" -Wno-pragma-system-header-outside-header -Wno-user-defined-literals 
```

But get the same result

  [1]: https://releases.llvm.org/15.0.0/tools/clang/docs/StandardCPlusPlusModules.html
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJztWEuPozgQ_jXkYoF4BBIOOXRe2kg7O62dlmZvyEARvDIY2aZ7en_9lnnk0cPOjNS9rT4kMg4pm3JV-auK-VKRP68O5AiaUJKJqmGcaiZqAlIKSZ5KqImWz6w-Ei0IqxohNbEi1wo2SksUW8EOfxJa54OYCRwAWg0DDJ8vgShaASkYB4d8ERXo0mhUAJUyelMgoigcy91a7l3fP5RMEWxPJdXkQEr6CGgIgxzVobig0iGWv0ypQhHay2pcts2M7TgqRUWscJ1xihaGW7z1zJcfD0ugpV3Dx8te1E_119hsLyK20rkVbLNe4rudgLMUZdgPYmJ_G-5s9aw0VHYJNAdJbLuR0EcT0Erf8vetktgbDdjzxwoXwTtWZ7zNAe8GRXj36JmBMYq-T4gtiNEyypwm6-T211rgQvRY0ev1bdFqxXI4mWMmtgoHcihYDbnNmQZJuSIf0vkBWReu95IP4jiaQBvqZE3Tm1hUIm852AbeOHNqp76fcu0RsbPRVaNaGNkLqF4mx0k4Bq6X-ntsZLStk40Ze52Xwfrl6DmZx7FhRq1Jg0Macw3Th1iLYZjgp4vWHbYM4260YDMulMB570IvOs2DOuenBYwGCbqVNfHc87KL7aSn17UBhvpUgVL0CKSvYEz9Z3ofatJvAdq3eE06LownY7intaSsxt5xfg7x5JHBEyoMXA_7EK_eL3ODS53ihn6wLLl6ZpOVVHb7NT3BX_RV8I28NqW4FgYLoAAxgWW9SynW_VmI4srcF3aw18V-rAaLM2wm3F1mWPg1STYYlgfLvyNJoiwfscf-gUQ_N4ACDrXBcPLH591fm939w1mhFe7efFP9aNFtaq8XdxTjB-b7InAlNWFFGFcpliv0cWojf-D3dT6evPjYaPfj8Ib2N0H7xEh0hXCswFtjOm25viq8_yfgb1C_gLp_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