/cp
authorpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 7 Feb 2009 02:05:04 +0000 (02:05 +0000)
committerpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 7 Feb 2009 02:05:04 +0000 (02:05 +0000)
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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@144001 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/cp-tree.h
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/vt-35147.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp0x/vt-37737-1.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp0x/vt-37737-2.C [new file with mode: 0644]

index 2a08d8b..690334d 100644 (file)
@@ -1,3 +1,9 @@
+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.
+
 2009-02-04  Jakub Jelinek  <jakub@redhat.com>
 
        PR c++/39095
index 186ec9a..f37c888 100644 (file)
@@ -2270,8 +2270,8 @@ extern void decl_shadowed_for_var_insert (tree, tree);
 
 /* 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)                       \
+#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
index 77e3ff7..7cde83d 100644 (file)
@@ -1,3 +1,11 @@
+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.
+
 2009-02-06  Joseph Myers  <joseph@codesourcery.com>
 
        PR c/35434
diff --git a/gcc/testsuite/g++.dg/cpp0x/vt-35147.C b/gcc/testsuite/g++.dg/cpp0x/vt-35147.C
new file mode 100644 (file)
index 0000000..67f282e
--- /dev/null
@@ -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();
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/vt-37737-1.C b/gcc/testsuite/g++.dg/cpp0x/vt-37737-1.C
new file mode 100644 (file)
index 0000000..32ea22d
--- /dev/null
@@ -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>();
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/vt-37737-2.C b/gcc/testsuite/g++.dg/cpp0x/vt-37737-2.C
new file mode 100644 (file)
index 0000000..11547e5
--- /dev/null
@@ -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>();
+}