mirror of
https://github.com/github/codeql.git
synced 2026-04-30 03:05:15 +02:00
C++: Add more explicit(bool) tests
This commit is contained in:
@@ -30,4 +30,38 @@ void TestExplicitBoolFun() {
|
||||
new TestExplicitBool(0.0);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
struct TestExplicitBool2 {
|
||||
explicit(sizeof(T) == 1)
|
||||
TestExplicitBool2(const T);
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
TestExplicitBool2<T>::TestExplicitBool2(const T) { }
|
||||
|
||||
void TestExplicitBoolFun2() {
|
||||
new TestExplicitBool2<char>(0);
|
||||
new TestExplicitBool2<int>(0);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
struct TestExplicitBool3 {
|
||||
template<typename U>
|
||||
explicit(sizeof(T) == 1)
|
||||
TestExplicitBool3(const T, const U);
|
||||
};
|
||||
|
||||
template<typename T> template<typename U>
|
||||
TestExplicitBool3<T>::TestExplicitBool3(const T, const U) { }
|
||||
|
||||
void TestExplicitBoolFun3() {
|
||||
new TestExplicitBool3<char>(0, 0);
|
||||
new TestExplicitBool3<int>(0, 0);
|
||||
}
|
||||
|
||||
struct TestExplicitBool4 {
|
||||
explicit(sizeof(char) == 1)
|
||||
TestExplicitBool4(const char);
|
||||
};
|
||||
|
||||
} // namespace cpp20
|
||||
|
||||
Reference in New Issue
Block a user