hokein added a comment.
BTW, could you please also update the
`docs/clang-tidy/checks/misc-definitions-in-headers.rst`?
Comment at: test/clang-tidy/misc-definitions-in-headers-1z.hpp:5
+class CE {
+ constexpr static int i = 5;
+};
Could you follow the way of
xazax.hun updated this revision to Diff 104111.
xazax.hun marked 5 inline comments as done.
xazax.hun added a comment.
Herald added a subscriber: JDevlieghere.
- Updates according to the reviews.
https://reviews.llvm.org/D34449
Files:
clang-tidy/misc/DefinitionsInHeadersCheck.cpp
test/clang
hokein added a comment.
Have thought this a bit more, I misunderstood your patch previously (sorry for
that).
I think what you intend to do is to ignore C++17 `inline variables` in headers,
am I correct?
Comment at: test/clang-tidy/misc-definitions-in-headers.hpp:1
-// RUN:
hokein added inline comments.
Comment at: test/clang-tidy/misc-definitions-in-headers.hpp:1
-// RUN: %check_clang_tidy %s misc-definitions-in-headers %t
+// RUN: %check_clang_tidy %s misc-definitions-in-headers %t -- -- -std=c++1z
The original code should work
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
xazax.hun created this revision.
xazax.hun added a project: clang-tools-extra.
Herald added a subscriber: whisperity.
Constexpr variable definitions should be ok in headers.
https://stackoverflow.com/questions/34445336/constexpr-global-constants-in-a-header-file-and-odr
Repository:
rL LLVM
h