[PATCH] D34449: [clang-tidy] Enable constexpr definitions in headers.

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 21 07:35:23 PDT 2017


aaron.ballman added inline comments.


================
Comment at: test/clang-tidy/misc-definitions-in-headers.hpp:180
+class CE {
+  constexpr static int i = 5; // OK: constexpr definition.
+};
----------------
This is not as safe as you might think. As-is, this is fine, however, if the class is given an inline function where that variable is odr-used, you will get an ODR violation.

I think it's mildly better to err on the side of safety here and diagnose.


Repository:
  rL LLVM

https://reviews.llvm.org/D34449





More information about the cfe-commits mailing list