diff mbox

[C++] PR 56534

Message ID 51377202.8020804@oracle.com
State New
Headers show

Commit Message

Paolo Carlini March 6, 2013, 4:42 p.m. UTC
... in fact, we could safely add this tiny clean-up too.

Paolo.

///////////////////

Comments

Jason Merrill March 6, 2013, 5:32 p.m. UTC | #1
On 03/06/2013 11:42 AM, Paolo Carlini wrote:
> +	/* NULL_TREE or error_mark_node (if decl is error_mark_node).  */
> +	type = TREE_TYPE (decl);

I'd prefer to avoid taking the TREE_TYPE of some random thing.  If what 
we want is NULL_TREE or error_mark_node, let's write that rather than 
expect to get it from TREE_TYPE.

Jason
diff mbox

Patch

Index: cp/decl.c
===================================================================
--- cp/decl.c	(revision 196497)
+++ cp/decl.c	(working copy)
@@ -11712,9 +11712,6 @@  check_elaborated_type_specifier (enum tag_types ta
 {
   tree type;
 
-  if (decl == error_mark_node)
-    return error_mark_node;
-
   /* In the case of:
 
        struct S { struct S *p; };
Index: cp/parser.c
===================================================================
--- cp/parser.c	(revision 196497)
+++ cp/parser.c	(working copy)
@@ -14248,12 +14248,15 @@  cp_parser_elaborated_type_specifier (cp_parser* pa
 				   typename_type,
 				   /*complain=*/tf_error);
       /* If the `typename' keyword is in effect and DECL is not a type
-	 decl. Then type is non existant.   */
+	 decl, then type is non existent.   */
       else if (tag_type == typename_type && TREE_CODE (decl) != TYPE_DECL)
         type = NULL_TREE; 
-      else 
-	type = check_elaborated_type_specifier (tag_type, decl,
+      else if (TREE_CODE (decl) == TYPE_DECL)
+        type = check_elaborated_type_specifier (tag_type, decl,
 						/*allow_template_p=*/true);
+      else
+	/* NULL_TREE or error_mark_node (if decl is error_mark_node).  */
+	type = TREE_TYPE (decl); 
     }
 
   if (!type)
Index: testsuite/g++.dg/template/crash115.C
===================================================================
--- testsuite/g++.dg/template/crash115.C	(revision 0)
+++ testsuite/g++.dg/template/crash115.C	(working copy)
@@ -0,0 +1,3 @@ 
+// PR c++/56534
+
+template < struct template rebind < > // { dg-error "expected" }