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:
Jeroen Ketema
2024-07-25 14:41:44 +02:00
parent c5da43e691
commit 3e7a60c1a6
8 changed files with 119 additions and 163 deletions

View File

@@ -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