re PR c++/56543 (ICE on valid code in copy_node_stat)

PR c++/56543
	* tree.c (strip_typedefs): Don't copy args if they are NULL.

	* g++.dg/template/typename20.C: New test.

From-SVN: r196492
This commit is contained in:
Jakub Jelinek 2013-03-06 16:27:13 +01:00 committed by Jakub Jelinek
parent 31c825fe96
commit 6457288eb6
4 changed files with 23 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2013-03-06 Jakub Jelinek <jakub@redhat.com>
PR c++/56543
* tree.c (strip_typedefs): Don't copy args if they are NULL.
2013-02-22 Jason Merrill <jason@redhat.com>
PR c++/40405

View File

@ -1209,7 +1209,8 @@ strip_typedefs (tree t)
case TYPENAME_TYPE:
{
tree fullname = TYPENAME_TYPE_FULLNAME (t);
if (TREE_CODE (fullname) == TEMPLATE_ID_EXPR)
if (TREE_CODE (fullname) == TEMPLATE_ID_EXPR
&& TREE_OPERAND (fullname, 1))
{
tree args = TREE_OPERAND (fullname, 1);
tree new_args = copy_node (args);

View File

@ -1,3 +1,8 @@
2013-03-06 Jakub Jelinek <jakub@redhat.com>
PR c++/56543
* g++.dg/template/typename20.C: New test.
2013-03-01 Richard Biener <rguenther@suse.de>
Backport from mainline

View File

@ -0,0 +1,11 @@
// PR c++/56543
template <typename>
struct S;
template <typename T>
struct U
{
typedef typename S <T>::template V <> W;
S <W> x;
};