]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/28363 (Default template parameter causes compiler segfault)
authorVolker Reichelt <reichelt@igpm.rwth-aachen.de>
Fri, 21 Jul 2006 09:50:08 +0000 (09:50 +0000)
committerVolker Reichelt <reichelt@gcc.gnu.org>
Fri, 21 Jul 2006 09:50:08 +0000 (09:50 +0000)
PR c++/28363
* semantics.c (check_template_template_default_arg): Simplify
error handling.

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

From-SVN: r115642

gcc/cp/ChangeLog
gcc/cp/semantics.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/template/defarg10.C [new file with mode: 0644]

index 6ecba8ae9bc5c79c5a9a1a8b4aac46bedcc2f0f4..b8e75fdb84182a36bf84c24631ba0cae95867d48 100644 (file)
@@ -1,3 +1,9 @@
+2006-07-21  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>
+
+       PR c++/28363
+       * semantics.c (check_template_template_default_arg): Simplify
+       error handling.
+
 2006-07-20  Steve Ellcey  <sje@cup.hp.com>
 
        PR c++/27495
index ab0abf1004c442406002ceec51327d145ee852a1..099f346e20dd79eb7b86555b9de1e629f104c746 100644 (file)
@@ -2056,19 +2056,8 @@ check_template_template_default_arg (tree argument)
       && TREE_CODE (argument) != UNBOUND_CLASS_TEMPLATE)
     {
       if (TREE_CODE (argument) == TYPE_DECL)
-       {
-         tree t = TREE_TYPE (argument);
-
-         /* Try to emit a slightly smarter error message if we detect
-            that the user is using a template instantiation.  */
-         if (CLASSTYPE_TEMPLATE_INFO (t) 
-             && CLASSTYPE_TEMPLATE_INSTANTIATION (t))
-           error ("invalid use of type %qT as a default value for a "
-                  "template template-parameter", t);
-         else
-           error ("invalid use of %qD as a default value for a template "
-                  "template-parameter", argument);
-       }
+       error ("invalid use of type %qT as a default value for a template "
+              "template-parameter", TREE_TYPE (argument));
       else
        error ("invalid default argument for a template template parameter");
       return error_mark_node;
index d0fb7afb00f7c2f60f418df0ba7ccff3a395e3a8..810230f41846cc07d4b900356d85a56dfcfbbc9e 100644 (file)
@@ -1,3 +1,8 @@
+2006-07-21  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>
+
+       PR c++/28363
+       * g++.dg/template/defarg10.C: New test.
+
 2006-07-20  Steve Ellcey  <sje@cup.hp.com>
 
        PR c++/27495
diff --git a/gcc/testsuite/g++.dg/template/defarg10.C b/gcc/testsuite/g++.dg/template/defarg10.C
new file mode 100644 (file)
index 0000000..281b108
--- /dev/null
@@ -0,0 +1,13 @@
+// PR c++/28363
+// { dg-do compile }
+
+template<typename T, template<int> class = T>  // { dg-error "invalid use of type" }
+struct A;
+
+typedef int I;
+template<template<int> class = I>  // { dg-error "invalid use of type" }
+struct B;
+
+struct S;
+template<template<int> class = S>  // { dg-error "invalid use of type" }
+struct C;