public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-6901] c++: Add a couple of CTAD testcases [PR82632]
@ 2022-01-27 19:34 Patrick Palka
  0 siblings, 0 replies; only message in thread
From: Patrick Palka @ 2022-01-27 19:34 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:fd59d5d4a2ef8a97541a22399480bc1f8e82ceca

commit r12-6901-gfd59d5d4a2ef8a97541a22399480bc1f8e82ceca
Author: Patrick Palka <ppalka@redhat.com>
Date:   Thu Jan 27 14:34:05 2022 -0500

    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:
---
 gcc/testsuite/g++.dg/cpp1z/class-deduction104.C | 17 +++++++++++++++++
 gcc/testsuite/g++.dg/cpp1z/class-deduction105.C | 17 +++++++++++++++++
 2 files changed, 34 insertions(+)

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 00000000000..a34dea04675
--- /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<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>;
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 00000000000..73a9c6b676a
--- /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<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;


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-01-27 19:34 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-27 19:34 [gcc r12-6901] c++: Add a couple of CTAD testcases [PR82632] Patrick Palka

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).