mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-23 05:46:11 +01:00
Prevent compilation of generators that use bool in dangerous manner
Closes #1692
This commit is contained in:
parent
03ffc1014c
commit
53281b471f
@ -70,6 +70,9 @@ namespace Generators {
|
|||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
class FixedValuesGenerator final : public IGenerator<T> {
|
class FixedValuesGenerator final : public IGenerator<T> {
|
||||||
|
static_assert(!std::is_same<T, bool>::value,
|
||||||
|
"ValuesGenerator does not support bools because of std::vector<bool>"
|
||||||
|
"specialization, use SingleValue Generator instead.");
|
||||||
std::vector<T> m_values;
|
std::vector<T> m_values;
|
||||||
size_t m_idx = 0;
|
size_t m_idx = 0;
|
||||||
public:
|
public:
|
||||||
|
@ -91,6 +91,9 @@ namespace Generators {
|
|||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
class RepeatGenerator : public IGenerator<T> {
|
class RepeatGenerator : public IGenerator<T> {
|
||||||
|
static_assert(!std::is_same<T, bool>::value,
|
||||||
|
"RepeatGenerator currently does not support bools"
|
||||||
|
"because of std::vector<bool> specialization");
|
||||||
GeneratorWrapper<T> m_generator;
|
GeneratorWrapper<T> m_generator;
|
||||||
mutable std::vector<T> m_returned;
|
mutable std::vector<T> m_returned;
|
||||||
size_t m_target_repeats;
|
size_t m_target_repeats;
|
||||||
|
Loading…
Reference in New Issue
Block a user