| Issue |
52860
|
| Summary |
clang-cl exception diagnostics don't match cl.exe with /std:c++17
|
| Labels |
new issue
|
| Assignees |
amykhuang
|
| Reporter |
amykhuang
|
clang-cl isn't strict enough with noexcept. Consider:
void f() noexcept;
void f() {}
cl.exe makes this an error (as does clang in non-clang-cl-mode):
<source>(2): error C2382: 'f': redefinition; different exception specifications
<source>(1): note: see declaration of 'f'
It's only a warning in clang-cl:
<source>:2:6: warning: 'f' is missing exception specification 'noexcept' [-Wmicrosoft-exception-spec]
void f() {}
^
noexcept
At the same time, clang-cl is too strict with __declspec(nothrow):
__declspec(nothrow) void g();
void g() {}
cl.exe does NOT diag this at all.
clang-cl warns:
<source>:5:6: warning: 'g' is missing exception specification '__attribute__((nothrow))' [-Wmicrosoft-exception-spec]
void g() {}
^
__attribute__((nothrow))
<source>:4:26: note: previous declaration is here
__declspec(nothrow) void g();
^
clang-cl should NOT warn here either. (Also, it uses the wrong spelling of the attribute in the diag, but if we don't diag at all that's a non-issue for this particular issue.)
This matters because the SDK contains:
#define STDMETHOD(method) virtual COM_DECLSPEC_NOTHROW HRESULT STDMETHODCALLTYPE method
So all STDMETHOD()s are declared __declspec(nothrow), but the SDK only does
#define STDMETHODIMP HRESULT STDMETHODCALLTYPE
So the default STDMETHOD / STDMETHODIMP pattern causes a warning with clang-cl with /std:c++17. (This does not happen without a /std: flag.)
(copied this over from the chromium bug tracker, originally filed by @nico)
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs