Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in is_heap_tests.hpp #3139

Closed
cogle opened this issue Feb 3, 2018 · 1 comment
Closed

Error in is_heap_tests.hpp #3139

cogle opened this issue Feb 3, 2018 · 1 comment

Comments

@cogle
Copy link
Contributor

cogle commented Feb 3, 2018

Currently in is_heap_tests.hpp lines 359-361 will not compile or will eventually not compile for any user using C++ 17.

The specific code causing this issue are the following lines

test_is_heap(execution::seq, IteratorTag(), test_for_is_heap);
test_is_heap(execution::par, IteratorTag(), test_for_is_heap);
test_is_heap(execution::par_unseq, IteratorTag(), test_for_is_heap);

These lines match to a templated function with the following signature

template <typename ExPolicy, typename IteratorTag, typename DataType = int>
void test_is_heap(ExPolicy policy, IteratorTag, DataType = DataType(),
    bool test_for_is_heap = true)

This is a subtle bug but the DataType is now a bool due to test_for_is_heap being a bool; this becomes an issue because in test_is_heap the following attempts to instantiate an vector of numbers beginning from a random point.

std::vector<DataType> c(10007);
std::iota(std::begin(c), std::end(c), DataType(std::rand()));

This was not a problem before because the pre-increment operator was implemented for type bool; with C++ 17 this is no longer the case and this operator has been deprecated. Therefor any C++ 17 compliant compiler will fail to compile at this point ++operator source. In addition the test most likely intended to test whether with the int data type.

@hkaiser
Copy link
Member

hkaiser commented Feb 3, 2018

@cogle Thanks for reporting this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants