Skip to content

Commit 5465a7f

Browse files
committed
[FOLD] add tests
1 parent 647fd2c commit 5465a7f

File tree

1 file changed

+50
-0
lines changed
  • clang/test/CXX/temp/temp.spec/temp.expl.spec

1 file changed

+50
-0
lines changed

clang/test/CXX/temp/temp.spec/temp.expl.spec/p7.cpp

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,3 +176,53 @@ namespace Defined {
176176
static_assert(A<short>::B<int>::y == 1);
177177
static_assert(A<short>::B<int*>::y == 2);
178178
} // namespace Defined
179+
180+
namespace Dependent {
181+
template<int I>
182+
struct A {
183+
template<int J>
184+
static constexpr int f();
185+
186+
template<int J>
187+
static const int x;
188+
189+
template<int J>
190+
struct B;
191+
};
192+
193+
template<>
194+
template<int J>
195+
constexpr int A<0>::f() {
196+
return A<1>::f<J>();
197+
}
198+
199+
template<>
200+
template<int J>
201+
constexpr int A<1>::f() {
202+
return J;
203+
}
204+
205+
template<>
206+
template<int J>
207+
constexpr int A<0>::x = A<1>::x<J>;
208+
209+
template<>
210+
template<int J>
211+
constexpr int A<1>::x = J;
212+
213+
template<>
214+
template<int J>
215+
struct A<0>::B {
216+
static constexpr int y = A<1>::B<J>::y;
217+
};
218+
219+
template<>
220+
template<int J>
221+
struct A<1>::B {
222+
static constexpr int y = J;
223+
};
224+
225+
static_assert(A<0>::f<2>() == 2);
226+
static_assert(A<0>::x<2> == 2);
227+
static_assert(A<0>::B<2>::y == 2);
228+
} // namespace Dependent

0 commit comments

Comments
 (0)