Index: docs/clang-tidy/checks/misc-definitions-in-headers.rst =================================================================== --- docs/clang-tidy/checks/misc-definitions-in-headers.rst +++ docs/clang-tidy/checks/misc-definitions-in-headers.rst @@ -82,6 +82,8 @@ constexpr int k = 1; // OK: constexpr variable has internal linkage. + constexpr int f10() { return 0; } // OK: constexpr function definition. + Options ------- Index: test/clang-tidy/check_clang_tidy.py =================================================================== --- test/clang-tidy/check_clang_tidy.py +++ test/clang-tidy/check_clang_tidy.py @@ -58,8 +58,8 @@ clang_tidy_extra_args = extra_args if len(clang_tidy_extra_args) == 0: - clang_tidy_extra_args = ['--', '--std=c++11'] if extension == '.cpp' \ - else ['--'] + clang_tidy_extra_args = ['--', '--std=c++11'] \ + if extension == '.cpp' or extension == '.hpp' else ['--'] # Tests should not rely on STL being available, and instead provide mock # implementations of relevant APIs. Index: test/clang-tidy/misc-definitions-in-headers.hpp =================================================================== --- test/clang-tidy/misc-definitions-in-headers.hpp +++ test/clang-tidy/misc-definitions-in-headers.hpp @@ -1,4 +1,4 @@ -// RUN: %check_clang_tidy %s misc-definitions-in-headers %t -- -- -std=c++11 +// RUN: %check_clang_tidy %s misc-definitions-in-headers %t int f() { // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: function 'f' defined in a header file; function definitions in header files can lead to ODR violations [misc-definitions-in-headers] @@ -177,3 +177,5 @@ } constexpr int k = 1; // OK: constexpr variable has internal linkage. + +constexpr int f10() { return 0; } // OK: constexpr function definition.