Skip to content

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

@JMazurkiewicz

Description

@JMazurkiewicz

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    fixedSomething works now, yay!rangesC++20/23 rangestestRelated to test code

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions