diff options
author | Jakub Jelinek <jakub@redhat.com> | 2012-12-01 00:51:26 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2012-12-01 00:51:26 +0100 |
commit | 55ad8d77abea762498975abf81dc029a97957a6d (patch) | |
tree | a0ef3b6ff2f660c06b70a91f3292e1ca083c90b9 /gcc | |
parent | a37d67b62172f4835d32a83bf54c8c1b4d171271 (diff) | |
download | gcc-55ad8d77abea762498975abf81dc029a97957a6d.zip gcc-55ad8d77abea762498975abf81dc029a97957a6d.tar.gz gcc-55ad8d77abea762498975abf81dc029a97957a6d.tar.bz2 |
re PR c++/55542 (g++ segmentation fault)
PR c++/55542
* pt.c (make_ith_pack_parameter_name): Return NULL if
name is NULL.
(tsubst_decl): Call make_ith_pack_parameter_name even if
DECL_NAME is NULL.
* g++.dg/cpp0x/vt-55542.C: New test.
From-SVN: r194010
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/cp/pt.c | 9 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/vt-55542.C | 22 |
4 files changed, 40 insertions, 4 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 60211d8..b419f64 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,11 @@ +2012-12-01 Jakub Jelinek <jakub@redhat.com> + + PR c++/55542 + * pt.c (make_ith_pack_parameter_name): Return NULL if + name is NULL. + (tsubst_decl): Call make_ith_pack_parameter_name even if + DECL_NAME is NULL. + 2012-11-29 Jason Merrill <jason@redhat.com> PR c++/53137 diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 3bc0d64..e349be6 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -2905,6 +2905,8 @@ make_ith_pack_parameter_name (tree name, int i) char* newname; int newname_len; + if (name == NULL_TREE) + return name; snprintf (numbuf, NUMBUF_LEN, "%i", i); newname_len = IDENTIFIER_LENGTH (name) + strlen (numbuf) + 2; @@ -10261,10 +10263,9 @@ tsubst_decl (tree t, tree args, tsubst_flags_t complain) /* Get the Ith type. */ type = TREE_VEC_ELT (expanded_types, i); - if (DECL_NAME (r)) - /* Rename the parameter to include the index. */ - DECL_NAME (r) = - make_ith_pack_parameter_name (DECL_NAME (r), i); + /* Rename the parameter to include the index. */ + DECL_NAME (r) + = make_ith_pack_parameter_name (DECL_NAME (r), i); } else if (!type) /* We're dealing with a normal parameter. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 573e390..a5e29e28 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2012-12-01 Jakub Jelinek <jakub@redhat.com> + + PR c++/55542 + * g++.dg/cpp0x/vt-55542.C: New test. + 2012-11-30 Eric Botcazou <ebotcazou@adacore.com> * gnat.dg/specs/pack9.ads: New test. diff --git a/gcc/testsuite/g++.dg/cpp0x/vt-55542.C b/gcc/testsuite/g++.dg/cpp0x/vt-55542.C new file mode 100644 index 0000000..3d5efee --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/vt-55542.C @@ -0,0 +1,22 @@ +// PR c++/55542 +// { dg-options "-std=c++11" } + +template <typename ... P> +struct B +{ + template <typename O> + B (O *o, void (O::*f) (P ... p)) {} +}; +class C +{ + void foo (void *, int); + template <typename ... A> + void bar (A ... a); + B <void *> c; + B <void *, int> d; + C (int) : c (this, &C::bar), d (this, &C::foo) {} +}; +template <typename ... A> +void C::bar (A ...) +{ +} |