public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Marek Polacek <polacek@redhat.com>
To: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: [pushed] c++: Add test for PR96268.
Date: Mon,  8 Mar 2021 15:29:11 -0500	[thread overview]
Message-ID: <20210308202911.43097-1-polacek@redhat.com> (raw)

This works since the recent r11-7102, but we didn't have a test for
a template-argument context.

Tested x86_64-pc-linux-gnu, applying to trunk.

gcc/testsuite/ChangeLog:

	PR c++/96268
	* g++.dg/cpp2a/nontype-class41.C: New test.
---
 gcc/testsuite/g++.dg/cpp2a/nontype-class41.C | 13 +++++++++++++
 1 file changed, 13 insertions(+)
 create mode 100644 gcc/testsuite/g++.dg/cpp2a/nontype-class41.C

diff --git a/gcc/testsuite/g++.dg/cpp2a/nontype-class41.C b/gcc/testsuite/g++.dg/cpp2a/nontype-class41.C
new file mode 100644
index 00000000000..2be88437072
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/nontype-class41.C
@@ -0,0 +1,13 @@
+// PR c++/96268
+// { dg-do compile { target c++20 } }
+
+template <int N>
+struct static_string { char chars[N]; /* operator<=> */ };
+
+template <int N>
+static_string(char const(&)[N]) -> static_string<N>;
+
+static_string hi = {"hi"};
+
+template <static_string str> struct name {};
+using Hi = name<{"hi"}>;

base-commit: bc56d27de97ecea813279ce5ba45b278dcccfe21
-- 
2.29.2


                 reply	other threads:[~2021-03-08 20:29 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=20210308202911.43097-1-polacek@redhat.com \
    --to=polacek@redhat.com \
    --cc=gcc-patches@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).