This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

C++ PATCH for c++/39750


The init-list code changed the parse of B<T>{} from a syntax error to a functional cast/compound literal. We need to teach uses_template_parms about compound literals.

Tested x86_64-pc-linux-gnu, applying to trunk and 4.4.
2009-04-13  Jason Merrill  <jason@redhat.com>

	PR c++/39750
	* pt.c (uses_template_parms): Handle CONSTRUCTOR.

diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 8dd3579..2fd6257 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -6325,6 +6325,7 @@ uses_template_parms (tree t)
 	   || TREE_CODE (t) == BASELINK
 	   || TREE_CODE (t) == IDENTIFIER_NODE
 	   || TREE_CODE (t) == TRAIT_EXPR
+	   || TREE_CODE (t) == CONSTRUCTOR
 	   || CONSTANT_CLASS_P (t))
     dependent_p = (type_dependent_expression_p (t)
 		   || value_dependent_expression_p (t));
diff --git a/gcc/testsuite/g++.dg/template/crash90.C b/gcc/testsuite/g++.dg/template/crash90.C
new file mode 100644
index 0000000..da24359
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/crash90.C
@@ -0,0 +1,8 @@
+// PR c++/39750
+
+template < unsigned >
+struct A ;
+template < typename >
+struct B ;
+template < typename T , A < B < T > // { dg-error "" }
+{ }

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]