<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/62573>62573</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
cuchar and iosfwd causes mbstate_t conflicts
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
Axel-Naumann
</td>
</tr>
</table>
<pre>
This is libc++ from Xcode 14.3 (14E222b) / MacOSX13.3.sdk. I realize this is probably not proper libc++ and would understand if you'd say "go away, talk to Apple". But maybe I'm lucky :-) and this reproduces easily for you. I did not see an existing issue referring to this problem.
```
$ cat repro.cxx
#include <cuchar>
#include <iosfwd>
std::mbstate_t *s;
$ clang -std=c++17 -c repro.cxx
In file included from repro.cxx:2:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/iosfwd:99:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__mbstate_t.h:44:9: error: target of using declaration conflicts with declaration already in scope
using ::mbstate_t _LIBCPP_USING_IF_EXISTS;
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/_types/_mbstate_t.h:32:28: note: target of using declaration
typedef __darwin_mbstate_t mbstate_t;
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/cuchar:49:1: note: conflicting declaration
using ::mbstate_t _LIBCPP_USING_IF_EXISTS;
^
In file included from repro.cxx:2:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/iosfwd:230:14: error: reference to unresolved using declaration
typedef fpos<mbstate_t> streampos;
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/cuchar:49:1: note: using declaration annotated with 'using_if_exists' here
using ::mbstate_t _LIBCPP_USING_IF_EXISTS;
^
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzUVk1v4zYQ_TX0ZWBBIv2lgw5yEhVG222AbIHcBIoc2WxoUiCpOOqvLyg5dpIuumh7yQKGTXLGM49vnkbDvVd7g1iQ5ZYsb2e8DwfrivIF9fwL74_cmFlj5VB8PSgPyoNWjSB0S-gWWmeP8CisRMgWCQNCN9nijlLaEJoDoRX8ysVvD48ZS1ji5VMCO3DItfoTIZzDdc42vNEDGBvipkP3NgU3Ek621xJ6I9H5EA9UC4PtCV1L8HwAQuneAj_xgdAbCFw_QbBQdp1GQmkC2z7AkQ8Nwo7Q9RF0L54GIKycR5gx4AjGYees7AV6QO6VHqC1LiaKsKWSI0KPCNwAvigflNmD8r5HcNiic3Ef7BQsXkvjMSHpLUnL8_cqPX-mLV2A4GHKm4iXl9djpozQvUQg7Eb04sAdYXffMirr25O8GH2QhJWElcfGBx6wDkBo6QnbvkmoudnDfHS9PZOcrWEuPsLYGWiVRjink1Oxr06spDHZP_gSWsUaKMGDssYTWo1SSXjXEVrdWBPQhHh8i8-oY-EJre41D611x3g-iSfpzkcfPB9uf37j5OUToVXvo-UMg9DqfEFCq-csGs58lXl-wf75UNb1pX7JgbBysYiICSsBnbMuLgJ3ewxgW-h9VJ1EobkbbwDCmlYrETycVDi8M3HtkMsBlAEvbIcTA1OIj8qpf9ltb-7v698fdl9-qndVffe4e_j6cBETkOXdp2HQD9GlDkOH4-I9gSwqlW4iccYG_A6B06ViKIkt1LXk7qTMNSRcVp-Tiw9qem0g5SJKKHtLwqtSvknAf1PFhYh_0z4-H2mXRkFZGllbvHv6xm6PRmDs9r1x6K1-Rvk9KbWd9YTdvJHPHfjgkB9Hw4-tpb_3IW6MjReVUx8idD361Kqtx7enJ3QNB3T_qwtdyXr_bp3Jgsmc5XyGRbbaMJbSzYrODkUu2jTLWLbYrPgyFbLJU7lsM8pWjOVyuZqpgqaUpct0ma3SNVslq2yRUtnKPBcyX20yskjxyJVOtH4-JtbtZ-MMUKzocs1mmjeo_ThMUWrwNA0IhNI4W7ki_mfe9HtPFqmOJFyjBBU0FhPF41AyiRAE7z36a9e5NvhZ73RxCKHzkTZaEVrtVTj0TSJsrHYMff6Zd87-gSLE6kZAsfIj4L8CAAD__9mFNjM">