diff 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
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gcc/testsuite/g++.dg/cpp2a/class-deduction-alias2.C	Thu Feb 13 11:34:05 2020 +0900
@@ -0,0 +1,22 @@
+// Test that a non-template deduction guide that doesn't match the alias is
+// ignored.
+// { dg-do compile { target c++2a } }
+
+template <class T> struct identity { using type = T; };
+template <class T> using identity_t = typename identity<T>::type;
+
+template <class T, class U> struct C {
+  C(T, U);			// #1
+};
+
+C(char*, char*) -> C<int,int>;  // #3
+
+template<class V>
+using A = C<V *, V *>;
+
+char c;
+A a4 (&c, &c);			// ignores #3 because C<int,int> is not an A<V>
+
+static_assert (__is_same_as(decltype(a4),A<char>));
+
+C c2 (&c, &c);			// { dg-error "conversion" } deduces with #3