//===----------------------------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // UNSUPPORTED: c++03, c++11, c++14, c++17 // // LWG-3382 NTTP for pair and array: // pair is a structural type ([temp.param]) if T and U are both structural types. // This deprecated ABI switch makes pair a non-structural type. // XFAIL: libcpp-deprecated-abi-disable-pair-trivial-copy-ctor #include #include #include struct LiteralBase {}; struct LiteralNSDM {}; struct LiteralType : LiteralBase { LiteralNSDM nsdm; }; struct NotALiteral { NotALiteral() {} }; int i; NotALiteral not_a_literal; namespace test_full_type { template P> struct test {}; using A = test; using B = test; using C = test; using D = test{}>; using E = test{&i, &i}>; using F = test; using G = test{std::move(i), std::move(i)}>; // expected-error@*:* {{type 'std::pair' of non-type template parameter is not a structural type}} using H = test{}>; // expected-error@*:* {{non-type template parameter has non-literal type 'std::pair'}} using I = test{}>; // expected-error-re@*:* {{type 'std::pair<{{(std::)?}}string, {{(std::)?}}string>' {{(\(aka 'pair, basic_string>'\) )?}}of non-type template parameter is not a structural type}} } // namespace test_full_type namespace test_ctad { template struct test {}; using A = test; using B = test; using C = test; using D = test{}>; using E = test{&i, &i}>; using F = test; using G = test{std::move(i), std::move(i)}>; // expected-error@-1 {{type 'std::pair' of non-type template parameter is not a structural type}} using H = test{}>; // expected-error@-1 {{non-type template parameter has non-literal type 'std::pair'}} using I = test{}>; // expected-error-re@*:* {{type {{.+}} of non-type template parameter is not a structural type}} } // namespace test_ctad namespace test_auto { template struct test {}; using A = test; using B = test; using C = test; using D = test{}>; using E = test{&i, &i}>; using F = test; using G = test{std::move(i), std::move(i)}>; // expected-error@-1 {{type 'std::pair' of non-type template parameter is not a structural type}} using H = test{}>; // expected-error@-1 {{non-type template parameter has non-literal type 'std::pair'}} using I = test{}>; // expected-error-re@-1 {{type {{.+}} of non-type template parameter is not a structural type}} } // namespace test_auto