Skip to content

Commit 57e3e39

Browse files
committed
test char type template specialization
1 parent c725301 commit 57e3e39

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

clang-tools-extra/test/clang-tidy/checkers/portability/avoid-platform-specific-fundamental-types-chars.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,16 @@ void test_template_instantiation() {
173173
// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: avoid using platform-dependent character type 'char'; consider using 'char8_t' for text or 'std::byte' for bytes [portability-avoid-platform-specific-fundamental-types]
174174
}
175175

176+
// Test template specializations with char types
177+
template<typename T>
178+
void template_function(T param) {}
179+
180+
template<>
181+
void template_function<char>(char param) {
182+
// CHECK-MESSAGES: :[[@LINE-1]]:24: warning: avoid using platform-dependent character type 'char'; consider using 'char8_t' for text or 'std::byte' for bytes
183+
// CHECK-MESSAGES: :[[@LINE-2]]:30: warning: avoid using platform-dependent character type 'char'; consider using 'char8_t' for text or 'std::byte' for bytes
184+
}
185+
176186
// Test that integer and float types are NOT flagged when their options are disabled
177187
int should_not_warn_int = 42;
178188
long should_not_warn_long = 100L;

0 commit comments

Comments
 (0)