[PATCH] D25925: [clang-tidy] Update cert-err58-cpp to match its new generalised form.

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 24 14:21:27 PDT 2016


aaron.ballman added a comment.

Thank you for working on this! I have a few more test cases to try, but I think you're already handling them properly.



================
Comment at: test/clang-tidy/cert-static-object-exception.cpp:29
+  X(S = {}) noexcept;
+};
+
----------------
We should also have a test for implicitly-provided constructors, since those are `noexcept` if the data members all have `noexcept` constructors. Something like:
```
struct Y {
  S s;
};

Y y; // Diagnose

struct Z {
  T t;
};

Z z; // Do not diagnose
```


================
Comment at: test/clang-tidy/cert-static-object-exception.cpp:60
+// CHECK-MESSAGES: 32:5: note: possibly throwing function declared here
+int k = h();
 
----------------
Let's also make sure that we're properly catching conversion operators with a test like:
```
struct UserConv_Bad {
  operator int() noexcept(false);
};

struct UserConv_Good {
  operator int() noexcept;
};

UserConv_Bad some_bad_func();
UserConv_Good some_good_func();

int l = some_bad_func(); // Diagnose
int m = some_good_func(); // Do not diagnose
```


https://reviews.llvm.org/D25925





More information about the cfe-commits mailing list