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

action::push_back is a silent no-op rather than compile-time error on incompatible containers #33

Open
cstratopoulos opened this issue Apr 25, 2018 · 0 comments

Comments

@cstratopoulos
Copy link

The following snippet was tested with Visual Studio 2017 15.6.6.

#define _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS
#include <range/v3/action/push_back.hpp>

#include <set>

int main()
{
    std::set<int> s;
    ranges::action::push_back(s, 1);

    return s.size();
}

This successfully compiles with std:cpp14 or std:cpp17 and returns zero.

Expected behavior is a compile-time error with a static assertion related to std::set not satisfying the concept/ADL detection for push_back.

Oddly, if the first #define is commented out, compilation fails due to the macro not being defined, but also with the expected static assertion.

I am not sure if this is a bug with Range-V3-VS2015 or with MSVC itself. On g++7.2 the code fails at compile time with the expected static assertion failure.

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

No branches or pull requests

1 participant