* C++ PATCH for c++/49205 (failure to use variadic template constructor as default constructor)
@ 2011-06-20 14:28 Jason Merrill
0 siblings, 0 replies; only message in thread
From: Jason Merrill @ 2011-06-20 14:28 UTC (permalink / raw)
To: gcc-patches List
[-- Attachment #1: Type: text/plain, Size: 122 bytes --]
A variadic template can take no arguments, so it's a default constructor.
Tested x86_64-pc-linux-gnu, applying to trunk.
[-- Attachment #2: 49205.patch --]
[-- Type: text/x-patch, Size: 1345 bytes --]
commit 9f50baae331019464a94de275ae370cfebb30600
Author: Jason Merrill <jason@redhat.com>
Date: Sun Jun 19 21:55:11 2011 -0400
PR c++/49205
* call.c (sufficient_parms_p): Allow parameter packs too.
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index 05bf983..09d73d0 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -534,15 +534,16 @@ null_ptr_cst_p (tree t)
return false;
}
-/* Returns nonzero if PARMLIST consists of only default parms and/or
- ellipsis. */
+/* Returns nonzero if PARMLIST consists of only default parms,
+ ellipsis, and/or undeduced parameter packs. */
bool
sufficient_parms_p (const_tree parmlist)
{
for (; parmlist && parmlist != void_list_node;
parmlist = TREE_CHAIN (parmlist))
- if (!TREE_PURPOSE (parmlist))
+ if (!TREE_PURPOSE (parmlist)
+ && !PACK_EXPANSION_P (TREE_VALUE (parmlist)))
return false;
return true;
}
diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic-default.C b/gcc/testsuite/g++.dg/cpp0x/variadic-default.C
new file mode 100644
index 0000000..2625e25
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/variadic-default.C
@@ -0,0 +1,12 @@
+// PR c++/49205
+// { dg-options -std=c++0x }
+
+#include <initializer_list>
+
+struct A {
+ template<typename ...T> A(T...);
+ A(std::initializer_list<short>);
+ A(std::initializer_list<long>);
+};
+
+A a{};
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2011-06-20 14:26 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-20 14:28 C++ PATCH for c++/49205 (failure to use variadic template constructor as default constructor) Jason Merrill
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).