Skip to content

Commit 1750551

Browse files
committed
Add a test case for explicit template deduction guides.
1 parent abc8882 commit 1750551

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

clang/test/SemaCXX/cxx20-ctad-type-alias.cpp

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -234,16 +234,19 @@ int i = 0;
234234
AFoo s{i};
235235
static_assert(__is_same(decltype(s.t), int));
236236

237-
// explicit deduction guide.
238-
Foo(int) -> Foo<X>;
239-
AFoo s2{i};
240-
static_assert(__is_same(decltype(s2.t), X));
241-
242-
243237
template<class T>
244238
using BFoo = AFoo<T>;
245-
static_assert(__is_same(decltype(BFoo(i).t), X));
246239

240+
// template explicit deduction guide.
241+
template<class T>
242+
Foo(T) -> Foo<float>;
243+
static_assert(__is_same(decltype(AFoo(i).t), float));
244+
static_assert(__is_same(decltype(BFoo(i).t), float));
245+
246+
// explicit deduction guide.
247+
Foo(int) -> Foo<X>;
248+
static_assert(__is_same(decltype(AFoo(i).t), X));
249+
static_assert(__is_same(decltype(BFoo(i).t), X));
247250

248251
Foo(double) -> Foo<int>;
249252
static_assert(__is_same(decltype(AFoo(1.0).t), int));

0 commit comments

Comments
 (0)