From: Patrick Palka Date: Thu, 27 Jan 2022 19:34:05 +0000 (-0500) Subject: c++: Add a couple of CTAD testcases [PR82632] X-Git-Tag: upstream/12.2.0~1796 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=fd59d5d4a2ef8a97541a22399480bc1f8e82ceca;p=platform%2Fupstream%2Fgcc.git 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. --- diff --git a/gcc/testsuite/g++.dg/cpp1z/class-deduction104.C b/gcc/testsuite/g++.dg/cpp1z/class-deduction104.C new file mode 100644 index 0000000..a34dea0 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1z/class-deduction104.C @@ -0,0 +1,17 @@ +// PR c++/82632 +// { dg-do compile { target c++17 } } + +template struct Optional { + template Optional(U&&); +}; + +template Optional(A) -> Optional; + +Optional opt(1729); +Optional dupe(opt); + +using ty1 = decltype(opt); +using ty1 = Optional; + +using ty2 = decltype(dupe); +using ty2 = Optional; diff --git a/gcc/testsuite/g++.dg/cpp1z/class-deduction105.C b/gcc/testsuite/g++.dg/cpp1z/class-deduction105.C new file mode 100644 index 0000000..73a9c6b --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1z/class-deduction105.C @@ -0,0 +1,17 @@ +// PR c++/82632 +// { dg-do compile { target c++17 } } + +template +struct Foo { + Foo() = default; + Foo(const Foo&) = delete; + + template + Foo(const Foo&); +}; + +template +Foo(Foo) -> Foo; + +Foo a; +Foo b = a;