c++: Add a couple of CTAD testcases [PR82632]
PR c++/82632 gcc/testsuite/ChangeLog: * g++.dg/cpp1z/class-deduction104.C: New test. * g++.dg/cpp1z/class-deduction105.C: New test.
This commit is contained in:
parent
7eb61a45a1
commit
fd59d5d4a2
|
@ -0,0 +1,17 @@
|
|||
// PR c++/82632
|
||||
// { dg-do compile { target c++17 } }
|
||||
|
||||
template<class T> struct Optional {
|
||||
template<class U> Optional(U&&);
|
||||
};
|
||||
|
||||
template<class A> Optional(A) -> Optional<A>;
|
||||
|
||||
Optional opt(1729);
|
||||
Optional dupe(opt);
|
||||
|
||||
using ty1 = decltype(opt);
|
||||
using ty1 = Optional<int>;
|
||||
|
||||
using ty2 = decltype(dupe);
|
||||
using ty2 = Optional<int>;
|
|
@ -0,0 +1,17 @@
|
|||
// PR c++/82632
|
||||
// { dg-do compile { target c++17 } }
|
||||
|
||||
template<class T, int = 1>
|
||||
struct Foo {
|
||||
Foo() = default;
|
||||
Foo(const Foo&) = delete;
|
||||
|
||||
template<int I>
|
||||
Foo(const Foo<T, I>&);
|
||||
};
|
||||
|
||||
template<class T, int I>
|
||||
Foo(Foo<T,I>) -> Foo<T,I+1>;
|
||||
|
||||
Foo<int> a;
|
||||
Foo b = a;
|
Loading…
Reference in New Issue