[PATCH] D38209: [Sema] Correct nothrow inherited by noexcept

Erich Keane via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 26 15:31:33 PDT 2017


erichkeane added a comment.

In https://reviews.llvm.org/D38209#880559, @aaron.ballman wrote:

> In https://reviews.llvm.org/D38209#880553, @STL_MSFT wrote:
>
> > > do you think `__declspec(nothrow)` calling the terminate handler in Clang is a bug?
> >
> > It's certainly a behavior difference with potential performance impact, although I don't think it can be viewed as a bug, strictly speaking. MSVC treats `__declspec(nothrow)` as an optimization request, with undefined behavior if it's violated. Termination is definitely one of the possible results of undefined behavior.
> >
> > We've recently had to slightly rethink our EH strategy in light of C++17's addition of noexcept into the type system, and the removal of dynamic exception specifications (and the change in semantics to throw()). MSVC's /EHsc makes this extra fun. If you're interested, I can put you in contact with the compiler dev who recently made those changes.
>
>
> That might be helpful. I'm mostly interested in whether `__declspec(nothrow)` is intended to be part of the type system in the same way `noexcept` specifiers are.
>
> @erichkeane -- can you see whether `__attribute__((nothrow))` is part of the type system as far as GCC is concerned (in C++17 mode, assuming GCC has implemented that functionality already)?


I just did some playing around with godbolt, and it seems that attribute-nothrow does NOT modify the mangled name in GCC C++17 mode (when done as a template-parameter to a 'call' function), so it seems to me that it is NOT part of the type system in this regard.

Interestingly, however, GCC allows the first exampel in the test (Base w/ attribute, derrived with noexcept) with or WITHOUT the attribute.  It seems to just completely lack this check even in trunk.


https://reviews.llvm.org/D38209





More information about the cfe-commits mailing list