re PR c++/30895 (ICE with complex values in template parameter)

2007-03-04  Simon Martin  <simartin@users.sourceforge.net>

	PR c++/30895
	* tree.c (cp_tree_equal): Properly handle COMPLEX_CST trees.

From-SVN: r122532
This commit is contained in:
Simon Martin 2007-03-04 19:50:54 +00:00 committed by Simon Martin
parent 270d43bf1e
commit 2a2193e029
4 changed files with 24 additions and 0 deletions

View file

@ -1,3 +1,8 @@
2007-03-04 Simon Martin <simartin@users.sourceforge.net>
PR c++/30895
* tree.c (cp_tree_equal): Properly handle COMPLEX_CST trees.
2007-03-03 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
PR c++/15787

View file

@ -1670,6 +1670,10 @@ cp_tree_equal (tree t1, tree t2)
&& !memcmp (TREE_STRING_POINTER (t1), TREE_STRING_POINTER (t2),
TREE_STRING_LENGTH (t1));
case COMPLEX_CST:
return cp_tree_equal (TREE_REALPART (t1), TREE_REALPART (t2))
&& cp_tree_equal (TREE_IMAGPART (t1), TREE_IMAGPART (t2));
case CONSTRUCTOR:
/* We need to do this when determining whether or not two
non-type pointer to member function template arguments

View file

@ -1,3 +1,8 @@
2007-03-04 Simon Martin <simartin@users.sourceforge.net>
PR c++/30895
* g++.dg/parse/template23.C: New test.
2007-03-04 Roger Sayle <roger@eyesopen.com>
PR middle-end/30744

View file

@ -0,0 +1,10 @@
/* PR c++/30895 This used to ICE. */
/* { dg-do "compile" } */
template<int> struct A {};
template<typename T> struct B
{
A<T(0i)> a1; /* { dg-error "imaginary constants are a GCC extension" } */
A<T(0i)> a2; /* { dg-error "imaginary constants are a GCC extension" } */
};