[PATCH] D74468: [clang-tidy] No misc-definitions-in-headers warning on C++14 variable templates.

Dmitri Gribenko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 12 04:05:21 PST 2020


gribozavr2 accepted this revision.
gribozavr2 added inline comments.
This revision is now accepted and ready to land.


================
Comment at: clang-tools-extra/docs/clang-tidy/checks/misc-definitions-in-headers.rst:86
 
+   // OK: C++14 variable template is allowed.
+   template <class T>
----------------
s/is allowed/are inline/


================
Comment at: clang-tools-extra/test/clang-tidy/checkers/misc-definitions-in-headers-1z.hpp:14
+template<class T>
+constexpr T pi = T(3.1415926L);
----------------
I would prefer if you could make the test compatible with all language modes after C++11. You can do it by wrapping the variable template in `#if`s on the `__cplusplus` macro that contains the language version.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D74468/new/

https://reviews.llvm.org/D74468





More information about the cfe-commits mailing list