re PR c++/31446 (ICE with invalid template parameter)

/cp
2007-10-16  Paolo Carlini  <pcarlini@suse.de>

	PR c++/31446
	* pt.c (current_template_args): Do not change TREE_LIST elements
	with a TREE_VALUE of error_mark_node.

/testsuite
2007-10-16  Paolo Carlini  <pcarlini@suse.de>

	PR c++/31446
	* g++.dg/template/void11.C: New.
	* g++.dg/template/void2.C: Adjust error markers.
	* g++.dg/template/void10.C: Likewise.
	* g++.dg/template/crash55.C: Likewise.

From-SVN: r129391
This commit is contained in:
Paolo Carlini 2007-10-16 22:21:59 +00:00 committed by Paolo Carlini
parent 7aa1cb97eb
commit bf98d3b6c0
7 changed files with 31 additions and 5 deletions

View File

@ -1,3 +1,9 @@
2007-10-16 Paolo Carlini <pcarlini@suse.de>
PR c++/31446
* pt.c (current_template_args): Do not change TREE_LIST elements
with a TREE_VALUE of error_mark_node.
2007-10-16 Mark Mitchell <mark@codesourcery.com>
* typeck.c (cp_apply_type_quals_to_decl): Expand documentation.

View File

@ -3136,8 +3136,8 @@ current_template_args (void)
TREE_TYPE (t) = type;
}
}
TREE_VEC_ELT (a, i) = t;
}
TREE_VEC_ELT (a, i) = t;
}
}

View File

@ -1,3 +1,11 @@
2007-10-16 Paolo Carlini <pcarlini@suse.de>
PR c++/31446
* g++.dg/template/void11.C: New.
* g++.dg/template/void2.C: Adjust error markers.
* g++.dg/template/void10.C: Likewise.
* g++.dg/template/crash55.C: Likewise.
2007-10-16 Mark Mitchell <mark@codesourcery.com>
* g++.dg/opt/const5.C: New test.

View File

@ -1,6 +1,6 @@
//PR c++/27668
template<typename class T, T = T()> // { dg-error "nested-name-specifier|two or more|valid type" }
struct A {}; // { dg-error "definition|template" }
struct A {};
template<int> void foo(A<int>); // { dg-error "mismatch|constant|template argument" }

View File

@ -7,4 +7,4 @@ template<void> struct A // { dg-error "not a valid type" }
template<typename> struct B {};
B<int> b; // { dg-error "template argument|invalid type" }
B<int> b;

View File

@ -0,0 +1,12 @@
// PR c++/31446
template<void> struct A // { dg-error "valid type" }
{
template<int> friend void foo();
};
void bar()
{
foo<0>(); // { dg-error "not declared|primary-expression" }
}

View File

@ -3,7 +3,7 @@
template<int> struct A
{
template<void> friend class X; // { dg-error "void" }
template<void> friend class X; // { dg-error "void|valid type" }
};
A<0> a;
A<0> a;