From: Jason Merrill <jason@redhat.com>
To: gcc-patches List <gcc-patches@gcc.gnu.org>
Subject: C++ PATCH for c++/49420 (ICE printing variadic error context)
Date: Thu, 16 Jun 2011 21:48:00 -0000 [thread overview]
Message-ID: <4DFA7983.6090508@redhat.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 199 bytes --]
With ENABLE_CHECKING we want to make sure that we're tracking the number
of non-default template arguments, but that doesn't apply to argument packs.
Tested x86_64-pc-linux-gnu, applying to trunk.
[-- Attachment #2: 49420.patch --]
[-- Type: text/x-patch, Size: 1411 bytes --]
commit 8ed2e06bbc3925a1c8d86641938f83e9bbd15bda
Author: Jason Merrill <jason@redhat.com>
Date: Wed Jun 15 12:24:17 2011 -0400
PR c++/49420
* error.c (dump_template_argument): Don't try to omit default
template args from an argument pack.
diff --git a/gcc/cp/error.c b/gcc/cp/error.c
index 22470dc..7c90ec4 100644
--- a/gcc/cp/error.c
+++ b/gcc/cp/error.c
@@ -147,7 +147,9 @@ static void
dump_template_argument (tree arg, int flags)
{
if (ARGUMENT_PACK_P (arg))
- dump_template_argument_list (ARGUMENT_PACK_ARGS (arg), flags);
+ dump_template_argument_list (ARGUMENT_PACK_ARGS (arg),
+ /* No default args in argument packs. */
+ flags|TFF_NO_OMIT_DEFAULT_TEMPLATE_ARGUMENTS);
else if (TYPE_P (arg) || TREE_CODE (arg) == TEMPLATE_DECL)
dump_type (arg, flags & ~TFF_CLASS_KEY_OR_ENUM);
else
diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic112.C b/gcc/testsuite/g++.dg/cpp0x/variadic112.C
new file mode 100644
index 0000000..1640657
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/variadic112.C
@@ -0,0 +1,19 @@
+// PR c++/49420
+// { dg-options -std=c++0x }
+
+struct A { };
+
+template <class T> struct B
+{
+ typedef typename T::type type ; // { dg-error "no type" }
+};
+
+template <typename Array, typename... Args>
+typename B<Array>::type
+get(const Array& a, Args... args);
+
+int main()
+{
+ A a;
+ int x = get(a, 1, 2, 3); // { dg-error "no match" }
+}
reply other threads:[~2011-06-16 21:45 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=4DFA7983.6090508@redhat.com \
--to=jason@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).