public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Patrick Palka <ppalka@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r12-6901] c++: Add a couple of CTAD testcases [PR82632]
Date: Thu, 27 Jan 2022 19:34:20 +0000 (GMT)	[thread overview]
Message-ID: <20220127193420.CF15D3858430@sourceware.org> (raw)

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;


                 reply	other threads:[~2022-01-27 19:34 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220127193420.CF15D3858430@sourceware.org \
    --to=ppalka@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).