diff options
author | Jakub Jelinek <jakub@redhat.com> | 2011-01-07 12:49:44 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2011-01-07 12:49:44 +0100 |
commit | a14e516339b8d3b5a3a35ec1c6e33e74019bb576 (patch) | |
tree | d291264fa490c8d3846683eb61e314c2dda9a43e | |
parent | 4f0d010ebbaa108aa13729fc74a6738862440f9c (diff) | |
download | gcc-a14e516339b8d3b5a3a35ec1c6e33e74019bb576.zip gcc-a14e516339b8d3b5a3a35ec1c6e33e74019bb576.tar.gz gcc-a14e516339b8d3b5a3a35ec1c6e33e74019bb576.tar.bz2 |
re PR c++/47022 (ICE: in tsubst_copy, at cp/pt.c:11682)
PR c++/47022
* pt.c (tsubst_copy_and_build): Use tsubst instead of tsubst_copy
for the second build_x_va_arg argument.
* g++.dg/template/stdarg1.C: New test.
From-SVN: r168564
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/pt.c | 3 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/template/stdarg1.C | 53 |
4 files changed, 65 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 67411a5..35d8864 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2011-01-07 Jakub Jelinek <jakub@redhat.com> + + PR c++/47022 + * pt.c (tsubst_copy_and_build): Use tsubst instead of tsubst_copy + for the second build_x_va_arg argument. + 2011-01-05 Tom Tromey <tromey@redhat.com> * typeck.c (cp_build_addr_expr_1): Update call to lvalue_error. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index ae6aed0..d9dbbe0 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -13239,8 +13239,7 @@ tsubst_copy_and_build (tree t, case VA_ARG_EXPR: return build_x_va_arg (RECUR (TREE_OPERAND (t, 0)), - tsubst_copy (TREE_TYPE (t), args, complain, - in_decl)); + tsubst (TREE_TYPE (t), args, complain, in_decl)); case OFFSETOF_EXPR: return finish_offsetof (RECUR (TREE_OPERAND (t, 0))); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 0a1c3d0..2bab56a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2011-01-07 Jakub Jelinek <jakub@redhat.com> + + PR c++/47022 + * g++.dg/template/stdarg1.C: New test. + 2011-01-06 Daniel Franke <franke.daniel@gmail.com> PR fortran/47195 diff --git a/gcc/testsuite/g++.dg/template/stdarg1.C b/gcc/testsuite/g++.dg/template/stdarg1.C new file mode 100644 index 0000000..ddc8c78 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/stdarg1.C @@ -0,0 +1,53 @@ +// PR c++/47022 +// { dg-do compile } + +#include <cstdarg> + +template <typename T> +void +f1 (T *p, va_list ap) +{ + *p = va_arg (ap, long double); + *p += va_arg (ap, double); +} + +template <typename T> +void +f2 (T *p, va_list ap) +{ + *p = __real__ va_arg (ap, _Complex int); + *p += __imag__ va_arg (ap, _Complex double); + *p += __imag__ va_arg (ap, _Complex long double); +} + +template <typename T> +void +f3 (T *p, va_list ap) +{ + *p = va_arg (ap, T); +} + +void +foo (int x, va_list ap) +{ + if (x == 0) + { + long double ld; + f1 (&ld, ap); + } + else if (x == 1) + { + int i; + f2 (&i, ap); + } + else if (x == 2) + { + long double ld; + f3 (&ld, ap); + } + else if (x == 3) + { + _Complex double cd; + f3 (&cd, ap); + } +} |