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

verifyAll won't compile with some c++20 ranges view. #174

Open
bogado opened this issue Mar 11, 2021 · 5 comments
Open

verifyAll won't compile with some c++20 ranges view. #174

bogado opened this issue Mar 11, 2021 · 5 comments

Comments

@bogado
Copy link

bogado commented Mar 11, 2021

The function verifyAll assumes that the Container has an associated type name value_type. This is not true for all views. The issue show up on "approvalTests.hpp:1656" for version 10.8.0.

 [&](typename Container::value_type e, std::ostream& s) {
@claremacrae
Copy link
Collaborator

Thank you for reporting this.

Do you have any suggestions as to how to fix this, please?
And how serious of a problem is this for you?

@claremacrae
Copy link
Collaborator

Sorry - closed in error - and re-opened.

@bogado
Copy link
Author

bogado commented Mar 23, 2021

To fix this I think that using std::iterator_traits would suffice. For example :

https://godbolt.org/z/8cG6b1x3Y

This would be friendly to older version of C++ and also be more portable. Depending on how you introduce the fix it might even work with old style sized arrays int[10] for instance.

@claremacrae
Copy link
Collaborator

Hi Victor (I assume!)

Thanks for reporting this, and for the Godbolt link.

It's probably going to be a little while until we get to this, so as a suggestion in the meantime, if you haven't done it already, we'd suggest a workaround of writing something:

void verifyAllInRange(...)
{
    // convert range to a vector or similar
    Approvals::verifyAll(vector...) 
}

@claremacrae
Copy link
Collaborator

Putting it on hold until either we move our tests to C++20 - or we have a CI build that builds on 20...

We can keep an eye on compiler support:
https://en.cppreference.com/w/cpp/compiler_support

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