Skip to content

Commit 4d89b43

Browse files
authored
Update test.cpp
1 parent c9e3684 commit 4d89b43

1 file changed

Lines changed: 17 additions & 1 deletion

File tree

  • cpp/common/test/rules/unsignedintegerliteralsnotappropriatelysuffixed

cpp/common/test/rules/unsignedintegerliteralsnotappropriatelysuffixed/test.cpp

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -543,4 +543,20 @@ void test_macro() {
543543
COMPLIANT_VAL; // COMPLIANT
544544
NON_COMPLIANT_VAL; // NON_COMPLIANT[FALSE_NEGATIVE] - cannot determine suffix
545545
// in macro expansions
546-
}
546+
}
547+
548+
constexpr unsigned long long operator""_km(unsigned long long value) {
549+
return value;
550+
}
551+
552+
void test_user_defined_literal_exclusion() {
553+
0x80000000_km; // COMPLIANT - user-defined literal argument should be excluded
554+
}
555+
556+
template <typename T> unsigned long long instantiated_literal_exclusion() {
557+
return T{}; // COMPLIANT - template instantiation should be excluded
558+
}
559+
560+
void test_instantiated_literal_exclusion() {
561+
instantiated_literal_exclusion<int>();
562+
}

0 commit comments

Comments
 (0)