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

Testing: P2415R2_owning_view\test.cpp does not test anything #3613

Closed
JMazurkiewicz opened this issue Mar 31, 2023 · 0 comments · Fixed by #3753
Closed

Testing: P2415R2_owning_view\test.cpp does not test anything #3613

JMazurkiewicz opened this issue Mar 31, 2023 · 0 comments · Fixed by #3753
Labels
fixed Something works now, yay! ranges C++20/23 ranges test Related to test code

Comments

@JMazurkiewicz
Copy link
Contributor

JMazurkiewicz commented Mar 31, 2023

Currently P2415R2_owning_view\test.cpp looks like this:

// [banner, headers]

struct instantiator {
    template <ranges::input_range R>
    static constexpr void call() {
        if constexpr (move_constructible<R>) {
            // [ALL TESTS]
        }
    }
};

int main() {
    STATIC_ASSERT((test_in<instantiator, int>(), true));
    test_in<instantiator, int>();
}

When we add extra constraint to instantiator::call, which is negation of the condition in if constexpr statement:

struct instantiator {
    template <ranges::input_range R>
        requires (!move_constructible<R>)
    static constexpr void call() {
        if constexpr (move_constructible<R>) {
            // [ALL TESTS]
        }
    }
};

The test still passes, which means that the // [ALL TESTS] part is never executed.

@StephanTLavavej StephanTLavavej added test Related to test code ranges C++20/23 ranges labels Mar 31, 2023
@StephanTLavavej StephanTLavavej added the fixed Something works now, yay! label Jun 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fixed Something works now, yay! ranges C++20/23 ranges test Related to test code
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants