| Issue |
87548
|
| Summary |
[Clang] MSVC compatibility, LPWSTR from const wchar_t *, ternary?
|
| Labels |
clang
|
| Assignees |
|
| Reporter |
wasabii
|
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
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs