Debian Codegraph @

gcc/testsuite/g++.dg/cpp2a/class-deduction-alias2.C

raw
1 // Test that a non-template deduction guide that doesn't match the alias is
2 // ignored.
3 // { dg-do compile { target c++20 } }
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