comparison gcc/testsuite/g++.dg/cpp2a/class-deduction-alias2.C @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents
children
comparison
equal deleted inserted replaced
131:84e7813d76e9 145:1830386684a0
1 // Test that a non-template deduction guide that doesn't match the alias is
2 // ignored.
3 // { dg-do compile { target c++2a } }
4
5 template <class T> struct identity { using type = T; };
6 template <class T> using identity_t = typename identity<T>::type;
7
8 template <class T, class U> struct C {
9 C(T, U); // #1
10 };
11
12 C(char*, char*) -> C<int,int>; // #3
13
14 template<class V>
15 using A = C<V *, V *>;
16
17 char c;
18 A a4 (&c, &c); // ignores #3 because C<int,int> is not an A<V>
19
20 static_assert (__is_same_as(decltype(a4),A<char>));
21
22 C c2 (&c, &c); // { dg-error "conversion" } deduces with #3