diff options
author | Paolo Carlini <paolo.carlini@oracle.com> | 2009-02-07 02:05:04 +0000 |
---|---|---|
committer | Paolo Carlini <paolo@gcc.gnu.org> | 2009-02-07 02:05:04 +0000 |
commit | da1512ad7ede2ab7b321baa4cb03e7239342a154 (patch) | |
tree | d7dc4df955e233e85f3cf9717534111f6cd9502e /gcc | |
parent | feab5a6736e2b15d13d3d989b802f5da630a143d (diff) | |
download | gcc-da1512ad7ede2ab7b321baa4cb03e7239342a154.zip gcc-da1512ad7ede2ab7b321baa4cb03e7239342a154.tar.gz gcc-da1512ad7ede2ab7b321baa4cb03e7239342a154.tar.bz2 |
re PR c++/35147 (ICE trying to expand an argument pack with zero arguments)
/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.
From-SVN: r144001
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/cp-tree.h | 4 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/vt-35147.C | 17 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/vt-37737-1.C | 11 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/vt-37737-2.C | 15 |
6 files changed, 59 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 2a08d8b..690334d 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -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 diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index 186ec9a..f37c888 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -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 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 77e3ff7..7cde83d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -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 index 0000000..67f282e --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/vt-35147.C @@ -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 index 0000000..32ea22d --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/vt-37737-1.C @@ -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 index 0000000..11547e5 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/vt-37737-2.C @@ -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>(); +} |