mirror of
https://github.com/github/codeql.git
synced 2026-04-29 10:45:15 +02:00
C++: Add additional test cases for explict and explicit(bool) specifiers
Note that the `explict(bool)` specifiers currently do not end up in the database.
This commit is contained in:
@@ -7,4 +7,27 @@ class TestConstexpr {
|
||||
constexpr int member_const_constexpr() const { return 0; }
|
||||
};
|
||||
|
||||
struct TestExplict {
|
||||
explicit TestExplict();
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
struct TestExplicitBool {
|
||||
explicit(sizeof(T) == 1)
|
||||
TestExplicitBool(const T);
|
||||
};
|
||||
|
||||
explicit TestExplicitBool(const double) -> TestExplicitBool<int>;
|
||||
|
||||
template<typename T>
|
||||
explicit(sizeof(T) == 4)
|
||||
TestExplicitBool(const T) -> TestExplicitBool<int>;
|
||||
|
||||
void TestExplicitBoolFun() {
|
||||
new TestExplicitBool<char>(0);
|
||||
new TestExplicitBool<int>(0);
|
||||
new TestExplicitBool(0.0f);
|
||||
new TestExplicitBool(0.0);
|
||||
}
|
||||
|
||||
} // namespace cpp20
|
||||
|
||||
Reference in New Issue
Block a user