public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Patrick Palka <ppalka@redhat.com>
To: gcc-patches@gcc.gnu.org
Subject: [PATCH] c++: parameter pack inside static_assert [PR99893]
Date: Thu, 27 May 2021 11:05:17 -0400	[thread overview]
Message-ID: <20210527150517.3398785-1-ppalka@redhat.com> (raw)

Here, we're not finding the parameter pack inside the static_assert because
STATIC_ASSERT trees are tcc_exceptional, and we weren't explicitly walking
them in cp_walk_subtrees.

Bootstrapped and regtested on x86_64-pc-linux-gnu, does this look OK for
trunk?

gcc/cp/ChangeLog:

	PR c++/99893
	* tree.c (cp_walk_subtrees) <case STATIC_ASSERT>: New case.

gcc/testsuite/ChangeLog:

	PR c++/99893
	* g++.dg/cpp0x/static_assert17.C: New test.
---
 gcc/cp/tree.c                                | 5 +++++
 gcc/testsuite/g++.dg/cpp0x/static_assert17.C | 9 +++++++++
 2 files changed, 14 insertions(+)
 create mode 100644 gcc/testsuite/g++.dg/cpp0x/static_assert17.C

diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index 372d89fa9ed..fec5afaa2be 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -5446,6 +5446,11 @@ cp_walk_subtrees (tree *tp, int *walk_subtrees_p, walk_tree_fn func,
 	}
       break;
 
+    case STATIC_ASSERT:
+      WALK_SUBTREE (STATIC_ASSERT_CONDITION (*tp));
+      WALK_SUBTREE (STATIC_ASSERT_MESSAGE (*tp));
+      break;
+
     default:
       return NULL_TREE;
     }
diff --git a/gcc/testsuite/g++.dg/cpp0x/static_assert17.C b/gcc/testsuite/g++.dg/cpp0x/static_assert17.C
new file mode 100644
index 00000000000..64843c60edd
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/static_assert17.C
@@ -0,0 +1,9 @@
+// PR c++/99893
+// { dg-do compile { target c++11 } }
+
+void f(...);
+
+template <class... Ts>
+void g() {
+  f([] { static_assert(Ts::value, ""); }...);
+}
-- 
2.32.0.rc0


             reply	other threads:[~2021-05-27 15:05 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-27 15:05 Patrick Palka [this message]
2021-05-27 17:40 ` Jason Merrill

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=20210527150517.3398785-1-ppalka@redhat.com \
    --to=ppalka@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).