Skip to content

Commit 095c17a

Browse files
committed
fixup! fixup! [clang-tidy] Added check to detect redundant inline keyword
Added few test cases for forward declaration
1 parent 0daf86a commit 095c17a

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

clang-tools-extra/test/clang-tidy/checkers/readability/redundant-inline-specifier.cpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,3 +114,22 @@ namespace ns
114114
auto fn6 = [](){};
115115
//CHECK-MESSAGES-NOT: :[[@LINE-1]]:1: warning: function 'operator()' has inline specifier but is implicitly inlined [readability-redundant-inline-specifier]
116116

117+
template <typename T> inline T fn7();
118+
// CHECK-MESSAGES: :[[@LINE-1]]:23: warning: function 'fn7' has inline specifier but is implicitly inlined [readability-redundant-inline-specifier]
119+
// CHECK-FIXES: template <typename T> T fn7();
120+
121+
template <typename T> T fn7()
122+
// CHECK-MESSAGES-NOT: :[[@LINE-1]]:1: warning: function 'fn7' has inline specifier but is implicitly inlined [readability-redundant-inline-specifier]
123+
{
124+
return T{};
125+
}
126+
127+
template <typename T> T fn8();
128+
// CHECK-MESSAGES-NOT: :[[@LINE-1]]:1: warning: function 'fn8' has inline specifier but is implicitly inlined [readability-redundant-inline-specifier]
129+
130+
template <typename T> inline T fn8()
131+
// CHECK-MESSAGES: :[[@LINE-1]]:23: warning: function 'fn8' has inline specifier but is implicitly inlined [readability-redundant-inline-specifier]
132+
// CHECK-FIXES: template <typename T> T fn8()
133+
{
134+
return T{};
135+
}

0 commit comments

Comments
 (0)