Debian Codegraph @

gcc/testsuite/g++.dg/cpp2a/explicit11.C

raw
1 // P0892R2
2 // { dg-do compile }
3 // { dg-options "-std=c++2a -pedantic" }
4
5 template<typename T>
6 struct A {
7 explicit A(const T&, ...) noexcept;
8 A(T&&, ...);
9 };
10
11 int i;
12 A a1 = { i, i }; // { dg-error "deduction|cannot|no match" }
13 A a2{ i, i };
14 A a3{ 0, i };
15 A a4 = { 0, i };
16
17 template<typename T> A(const T&, const T&) -> A<T&>;
18 template<typename T> explicit A(T&&, T&&) -> A<T>;
19
20 A a5 = { 0, 1 }; // { dg-error "deduction|ambiguous" }
21 A a6{ 0, 1 };
22
23 template<typename T>
24 struct B {
25 template<typename U> using TA = T;
26 template<typename U> B(U, TA<U>);
27 };
28
29 B b{(int *)0, (char *)0}; // { dg-error "deduction|no match" }