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

    <tr>
        <th>Summary</th>
        <td>
            [Clang] MSVC compatibility, LPWSTR from const wchar_t *, ternary?
        </td>
    </tr>

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

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

    <tr>
      <th>Reporter</th>
      <td>
          wasabii
      </td>
    </tr>
</table>

<pre>
    Hello. Have a funny peice of code I'm trying to get building in Clang. It's from some windows software. C++.

```
    LPWSTR getNonEmptyString() {
        return (NULL==m_pStr)
                ? L""
 : m_pStr;
    }
```

GD35A792B: cannot initialize return object of type 'LPWSTR' (aka 'wchar_t ') with an rvalue of type 'const wchar_t'

Builds fine in MSVC. So, probably, this needs a quirk of some kind with -fms-compatibility.

Not exactly sure why MSVC allows this. Since it seems pretty unsafe. But, eh.

Found here: https://github.com/openjdk/jdk8u/blob/04ccdbf84df493283a2755c996b3381500a79aa8/jdk/src/windows/native/sun/windows/awt.h#L341
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx8VF-Pq7YT_TTDy2gRMbDAAw-bzY_fvVK6qpr-ebwabBO8MTa1zab001cmubobqaplOXY84zMzZw7kvTobKVso91AeElrCaF17JU-9Uklvxdp-kVrbFL_Qh0TCYTFmxVkqLtEOyK2Q-BVYNWFwqzJnDBbPMmC_KC3iWRl81WTOKX4NwCqPg7MTejtJvCoj7NWjt0O4kpMpvgLbA9unkB0ge7mvz9l9bkdExOPPf5x-_SXivFnzv2kO6yk4Zc7AamANQrX_YRuHk2FxBoHVb78dj5AfID9M3-ZTcMCaR9PvA_IOj8BYnDcDyF_w7pR_eh-qw7_GeVv_f8jLl6ph--jNyRgbUBkVFGn1t_wemO3fJQ-xnmGdJQKrbhkCq2LQdKH435WP5L6FuI1ZXlUYkQy6D9KL_OzMrfEB7-bR-lNA-8iLx0EZGan56fT7a4onC-wVZ2d76vUa92FUHo2UwiPhn4tylwiwsXZRRtzAn4bJP3E7zRRUr7QK6wNxbzag_It40Cv6xUm8jusGiKR15D2CpHhShktUAb2Uk8fZyRBWXIynQaa4X0KMR44PT3d2MQJH6WSs6xjC7CF_AdYB684qjEufcjsB6-wszbu4AOvexaVegHW9tj2wLis4F_1QF2IompzVObGqLHnTPPd5Xu_KLKOqIapvnsA67ziw7t6ywDpDQX3IeLGYhwu6hnQElh_zYpeINhdN3lAi2121Y7uqyLMmGduhZ7tSDDyrh-FZUFWwuqlLqkRfloJzSlTLMlZkRZbvmrJmTbrjff1cloJyYiRoB0UmJ1I61fpjSq07J8r7RbZ1VRZ1oqmX2m-yZoxH_cVGLg-Ja6P9U7-cPRSZVj74Hy8EFfT2LdgUC-XhRtcDxZGNu_42JT80GwJ72dpHOkNuhbxLFqfb_yAoYt9_nmZnow6AdVsqsZhbNv8EAAD__8_YbJY">