Revert "[llvm] Improve llvm.objectsize computation by computing GEP, alloca and mallo...
[llvm-project.git] / clang / test / CXX / temp / temp.decls / temp.spec.partial / temp.spec.partial.member / p2.cpp
blob61f8b1c32e264677934f619cae593a2ddc9d99fa
1 // RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify %s
3 template<typename T>
4 struct A {
5 template<typename U>
6 struct B {
7 static constexpr int y = 0;
8 };
10 template<typename U>
11 struct B<U*> {
12 static constexpr int y = 1;
15 template<typename U>
16 static constexpr int x = 0;
18 template<typename U>
19 static constexpr int x<U*> = 1;
22 template<typename T>
23 template<typename U>
24 struct A<T>::B<U[]> {
25 static constexpr int y = 2;
28 template<typename T>
29 template<typename U>
30 constexpr int A<T>::x<U[]> = 2;
32 static_assert(A<short>::B<int>::y == 0);
33 static_assert(A<short>::B<int*>::y == 1);
34 static_assert(A<short>::B<int[]>::y == 2);
35 static_assert(A<short>::x<int> == 0);
36 static_assert(A<short>::x<int*> == 1);
37 static_assert(A<short>::x<int[]> == 2);
39 template<>
40 template<typename U>
41 struct A<int>::B {
42 static constexpr int y = 3;
45 template<>
46 template<typename U>
47 struct A<int>::B<U&> {
48 static constexpr int y = 4;
51 template<>
52 template<typename U>
53 struct A<long>::B<U&> {
54 static constexpr int y = 5;
57 template<>
58 template<typename U>
59 constexpr int A<int>::x = 3;
61 template<>
62 template<typename U>
63 constexpr int A<int>::x<U&> = 4;
65 template<>
66 template<typename U>
67 constexpr int A<long>::x<U&> = 5;
69 static_assert(A<int>::B<int>::y == 3);
70 static_assert(A<int>::B<int*>::y == 3);
71 static_assert(A<int>::B<int[]>::y == 3);
73 // FIXME: This should pass!
74 static_assert(A<int>::B<int&>::y == 4); // expected-error {{static assertion failed due to requirement 'A<int>::B<int &>::y == 4'}}
75 // expected-note@-1 {{expression evaluates to '3 == 4'}}
76 static_assert(A<int>::x<int> == 3);
77 static_assert(A<int>::x<int*> == 3);
78 static_assert(A<int>::x<int[]> == 3);
80 // FIXME: This should pass!
81 static_assert(A<int>::x<int&> == 4); // expected-error {{static assertion failed due to requirement 'A<int>::x<int &> == 4'}}
82 // expected-note@-1 {{expression evaluates to '3 == 4'}}
83 static_assert(A<long>::B<int>::y == 0);
84 static_assert(A<long>::B<int*>::y == 1);
85 static_assert(A<long>::B<int[]>::y == 2);
86 static_assert(A<long>::B<int&>::y == 5);
87 static_assert(A<long>::x<int> == 0);
88 static_assert(A<long>::x<int*> == 1);
89 static_assert(A<long>::x<int[]> == 2);
90 static_assert(A<long>::x<int&> == 5);