[PATCH] D33333: Emit warning when throw exception in destruct or dealloc functions which has a (possible implicit) noexcept specifier

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 16 13:06:02 PDT 2017


aaron.ballman added a comment.

A few more nits, but this feels like it's getting close to ready (at least, to me).



================
Comment at: test/SemaCXX/warn-throw-out-noexcept-func.cpp:1
+// RUN: %clang_cc1 %s  -fdelayed-template-parsing -fcxx-exceptions -fexceptions -fsyntax-only -Wexceptions -verify -std=c++11
+struct A {
----------------
aaron.ballman wrote:
> aaron.ballman wrote:
> > Please drop the svn auto props.
> This does not appear to be done.
This file still has the svn auto props.


================
Comment at: test/SemaCXX/warn-throw-out-noexcept-func.cpp:1
+// RUN: %clang_cc1 %s  -fdelayed-template-parsing -fcxx-exceptions -fexceptions -fsyntax-only -Wexceptions -verify -std=c++11
+struct A {
----------------
I believe you can drop the -fcxx-exceptions as it should be implied by -fexceptions.


================
Comment at: test/SemaCXX/warn-throw-out-noexcept-func.cpp:27
+}
+
+struct N : A {
----------------
Can you add a test case like:
```
struct Throws {
  ~Throws() noexcept(false);
};

struct ShouldDiagnose {
  Throws T;
  ~ShouldDiagnose() {}
};
```
I would expect `~ShouldDiagnose()` to be diagnosed as allowing exceptions to escape because of the destructor for `Throws`.


https://reviews.llvm.org/D33333





More information about the cfe-commits mailing list