On 03/06/2013 03:34 PM, Jason Merrill wrote:
It sounds like the underlying problem is that "decl" isn't a
TYPE_DECL. So let's check for that instead.
I see. Thus, also considering that the only other use of
check_elaborated_type_specifier happens when the decl is known to be a
TYPE_DECL, I thought we could change the caller, go back to something
very similar to 4_6-branch + the call when appropriate. Passes testing.
Thanks!
Paolo.
////////////////////
Index: cp/parser.c
===================================================================
--- cp/parser.c (revision 196487)
+++ 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" }