|
| 1 | +// RUN: %clang_cc1 -triple arm64-apple-macosx -fsyntax-only -verify %s -std=c++26 -DINVALID_TYPE_IDENTITY_VERSION=0 |
| 2 | +// RUN: %clang_cc1 -triple arm64-apple-macosx -fsyntax-only -verify %s -std=c++26 -DINVALID_TYPE_IDENTITY_VERSION=1 |
| 3 | +// RUN: %clang_cc1 -triple arm64-apple-macosx -fsyntax-only -verify %s -std=c++26 -DINVALID_TYPE_IDENTITY_VERSION=2 |
| 4 | +// RUN: %clang_cc1 -triple arm64-apple-macosx -fsyntax-only -verify %s -std=c++26 -DINVALID_TYPE_IDENTITY_VERSION=3 |
| 5 | +// RUN: %clang_cc1 -triple arm64-apple-macosx -fsyntax-only -verify %s -std=c++26 -DINVALID_TYPE_IDENTITY_VERSION=4 |
| 6 | +// RUN: %clang_cc1 -triple arm64-apple-macosx -fsyntax-only -verify %s -std=c++26 |
| 7 | + |
| 8 | +namespace std { |
| 9 | +#if !defined(INVALID_TYPE_IDENTITY_VERSION) |
| 10 | + // expected-no-diagnostics |
| 11 | + template <class T> struct type_identity { |
| 12 | + }; |
| 13 | +#elif INVALID_TYPE_IDENTITY_VERSION==0 |
| 14 | + struct type_identity {}; |
| 15 | + // expected-error@-1 {{std::type_identity must be a class template with a single type parameter}} |
| 16 | +#elif INVALID_TYPE_IDENTITY_VERSION==1 |
| 17 | + template <class A, class B> struct type_identity {}; |
| 18 | + // expected-error@-1 {{std::type_identity must be a class template with a single type parameter}} |
| 19 | +#elif INVALID_TYPE_IDENTITY_VERSION==2 |
| 20 | + enum type_identity {}; |
| 21 | + // expected-error@-1 {{std::type_identity must be a class template with a single type parameter}} |
| 22 | +#elif INVALID_TYPE_IDENTITY_VERSION==3 |
| 23 | + template <class T> using type_identity = int; |
| 24 | + // expected-error@-1 {{std::type_identity must be a class template with a single type parameter}} |
| 25 | +#elif INVALID_TYPE_IDENTITY_VERSION==4 |
| 26 | + template <class T> struct inner {}; |
| 27 | + template <class T> using type_identity = inner<T>; |
| 28 | + // expected-error@-1 {{std::type_identity must be a class template with a single type parameter}} |
| 29 | +#endif |
| 30 | +} |
| 31 | + |
| 32 | +using size_t = __SIZE_TYPE__; |
| 33 | + |
| 34 | +struct TestType {}; |
| 35 | + |
| 36 | +void f() { |
| 37 | + TestType *t = new TestType; |
| 38 | + delete t; |
| 39 | +} |
0 commit comments