diff options
author | Nathan Sidwell <nathan@codesourcery.com> | 2000-09-01 09:39:33 +0000 |
---|---|---|
committer | Nathan Sidwell <nathan@gcc.gnu.org> | 2000-09-01 09:39:33 +0000 |
commit | 9687f8f4e020497637f9403cd99af40bfddf407a (patch) | |
tree | 25f670f92fbaa1d35854a850f747c31deee3a137 | |
parent | 291c9aa2c85fc02cc4c1d3a5877018bd664517b8 (diff) | |
download | gcc-9687f8f4e020497637f9403cd99af40bfddf407a.zip gcc-9687f8f4e020497637f9403cd99af40bfddf407a.tar.gz gcc-9687f8f4e020497637f9403cd99af40bfddf407a.tar.bz2 |
parse.y (named_class_head): Check for TYPENAME_TYPE.
* parse.y (named_class_head): Check for TYPENAME_TYPE. Simplify
union tag mismatch error reporting.
From-SVN: r36096
-rw-r--r-- | gcc/cp/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/cp/parse.y | 30 |
2 files changed, 23 insertions, 12 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 402c873..057b071 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,10 @@ 2000-09-01 Nathan Sidwell <nathan@codesourcery.com> + * parse.y (named_class_head): Check for TYPENAME_TYPE. Simplify + union tag mismatch error reporting. + +2000-09-01 Nathan Sidwell <nathan@codesourcery.com> + * call.c (build_scoped_method_call): Check it is not a namespace. 2000-08-30 Jason Merrill <jason@redhat.com> diff --git a/gcc/cp/parse.y b/gcc/cp/parse.y index 49785f2..8f23d91 100644 --- a/gcc/cp/parse.y +++ b/gcc/cp/parse.y @@ -2393,24 +2393,30 @@ named_class_head: { if ($1.t != error_mark_node) { - $$.t = TREE_TYPE ($1.t); + tree type = TREE_TYPE ($1.t); + + $$.t = type; $$.new_type_flag = $1.new_type_flag; - if (current_aggr == union_type_node - && TREE_CODE ($$.t) != UNION_TYPE) - cp_pedwarn ("`union' tag used in declaring `%#T'", - $$.t); - else if (TREE_CODE ($$.t) == UNION_TYPE - && current_aggr != union_type_node) - cp_pedwarn ("non-`union' tag used in declaring `%#T'", $$); - else if (TREE_CODE ($$.t) == RECORD_TYPE) + if ((current_aggr == union_type_node) + != (TREE_CODE (type) == UNION_TYPE)) + cp_pedwarn (current_aggr == union_type_node + ? "`union' tag used in declaring `%#T'" + : "non-`union' tag used in declaring `%#T'", + type); + else if (TREE_CODE (type) == RECORD_TYPE) /* We might be specializing a template with a different class-key; deal. */ - CLASSTYPE_DECLARED_CLASS ($$.t) + CLASSTYPE_DECLARED_CLASS (type) = (current_aggr == class_type_node); if ($2) { - maybe_process_partial_specialization ($$.t); - xref_basetypes (current_aggr, $1.t, $$.t, $2); + if (TREE_CODE (type) == TYPENAME_TYPE) + /* In a definition of a member class template, we + will get here with an implicit typename, a + TYPENAME_TYPE with a type. */ + type = TREE_TYPE (type); + maybe_process_partial_specialization (type); + xref_basetypes (current_aggr, $1.t, type, $2); } } } |