view gcc/testsuite/g++.dg/cpp2a/concepts-pr71965.C @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents
children
line wrap: on
line source

// { dg-do compile { target c++2a } }

template <class T>
concept Destructible = false;

template <class T, class...Args>
concept ConstructibleObject =
    // Concept evaluation should short-circuit even the template
    // substitution, so we shouldn't even substitute into the requires
    // constraint and the unimplemented multi-dimensional new T{...}
    // initialization.  ATM we do, but as long as we don't output the
    // sorry() message we used to for such constructs when asked not
    // to issue errors, this shouldn't be a problem for this and
    // similar cases.
    Destructible<T> && requires (Args&&...args) {
        new T{ (Args&&)args... };
    };

int main() {
    using T = int[2][2];
    // GCC has not implemented initialization of multi-dimensional
    // arrays with new{} expressions.
    static_assert(!ConstructibleObject<T, T>);
}