//===----------------------------------------------------------------------===// // // 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: // array is a structural type ([temp.param]) if T is a structural type. #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 A> struct test {}; using A = test; using B = test{}>; using C = test{&i}>; using D = test{¬_a_literal}>; using E = test{}>; // expected-error-re@*:* {{non-type template parameter has non-literal type 'std::array'}} using F = test{}>; // expected-error-re@*:* {{type 'std::array<{{(std::)?}}string, 2U{{L{0,2}.*}}>' {{(\(aka 'array, 2UL{0,2}>'\) )?}}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{&i}>; using D = test{¬_a_literal}>; using E = test{}>; // expected-error@-1 {{non-type template parameter has non-literal type 'std::array'}} using F = test{}>; // expected-error-re@-1 {{type 'std::array<{{(std::)?}}string, 2>'{{( \(aka 'std::array'\))?}} 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{&i}>; using D = test{¬_a_literal}>; using E = test{}>; // expected-error@-1 {{non-type template parameter has non-literal type 'std::array'}} using F = test{}>; // expected-error@-1 {{type 'std::array' (aka 'array, 2>') of non-type template parameter is not a structural type}} } // namespace test_auto