This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [C++ Patch] PR 35147 and 37737
Mark Mitchell wrote:
> I like this better. It's a conservative change, and it's intuitive; you
> can have zero-length lists of template arguments. This patch is OK.
>
Ok, thanks. This is what I actually committed.
Paolo.
////////////////
/cp
2009-02-06 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/35147
PR c++/37737
* cp-tree.h (TMPL_ARGS_HAVE_MULTIPLE_LEVELS): Check TREE_VEC_LENGTH.
/testsuite
2009-02-06 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/35147
PR c++/37737
* g++.dg/cpp0x/vt-35147.C: New.
* g++.dg/cpp0x/vt-37737-1.C: Likewise.
* g++.dg/cpp0x/vt-37737-2.C: Likewise.
Index: testsuite/g++.dg/cpp0x/vt-37737-1.C
===================================================================
*** testsuite/g++.dg/cpp0x/vt-37737-1.C (revision 0)
--- testsuite/g++.dg/cpp0x/vt-37737-1.C (revision 0)
***************
*** 0 ****
--- 1,11 ----
+ // { dg-options "-std=c++0x" }
+
+ void f() { }
+
+ template<class U, class... T>
+ void f(){ f<T...>(); } // { dg-error "no matching" }
+
+ int main()
+ {
+ f<char>();
+ }
Index: testsuite/g++.dg/cpp0x/vt-35147.C
===================================================================
*** testsuite/g++.dg/cpp0x/vt-35147.C (revision 0)
--- testsuite/g++.dg/cpp0x/vt-35147.C (revision 0)
***************
*** 0 ****
--- 1,17 ----
+ // { dg-options "-std=c++0x" }
+
+ template<typename _Tp>
+ _Tp&& forward(_Tp&& __t) { return __t; }
+
+ void f(...);
+
+ template<typename... Args>
+ void g(Args&&... args)
+ {
+ f(forward<Args...>(args...)); // { dg-error "no matching" }
+ }
+
+ void h()
+ {
+ g();
+ }
Index: testsuite/g++.dg/cpp0x/vt-37737-2.C
===================================================================
*** testsuite/g++.dg/cpp0x/vt-37737-2.C (revision 0)
--- testsuite/g++.dg/cpp0x/vt-37737-2.C (revision 0)
***************
*** 0 ****
--- 1,15 ----
+ // { dg-options "-std=c++0x" }
+
+ template<class U, class... T>
+ void f()
+ {
+ f<T...>(); // { dg-error "no matching" }
+ }
+
+ template<>
+ void f() { } // { dg-error "template-id" }
+
+ int main()
+ {
+ f<char>();
+ }
Index: cp/cp-tree.h
===================================================================
*** cp/cp-tree.h (revision 143984)
--- cp/cp-tree.h (working copy)
*************** extern void decl_shadowed_for_var_insert
*** 2270,2277 ****
/* Nonzero if the template arguments is actually a vector of vectors,
rather than just a vector. */
! #define TMPL_ARGS_HAVE_MULTIPLE_LEVELS(NODE) \
! (NODE && TREE_VEC_ELT (NODE, 0) \
&& TREE_CODE (TREE_VEC_ELT (NODE, 0)) == TREE_VEC)
/* The depth of a template argument vector. When called directly by
--- 2270,2277 ----
/* Nonzero if the template arguments is actually a vector of vectors,
rather than just a vector. */
! #define TMPL_ARGS_HAVE_MULTIPLE_LEVELS(NODE) \
! (NODE && TREE_VEC_LENGTH (NODE) && TREE_VEC_ELT (NODE, 0) \
&& TREE_CODE (TREE_VEC_ELT (NODE, 0)) == TREE_VEC)
/* The depth of a template argument vector. When called directly by