diff options
author | Mark Mitchell <mark@codesourcery.com> | 2003-01-23 00:17:32 +0000 |
---|---|---|
committer | Mark Mitchell <mmitchel@gcc.gnu.org> | 2003-01-23 00:17:32 +0000 |
commit | 65a5559bdf97989997b12c372ef4c77dd4740b19 (patch) | |
tree | d5c3c68f7468b575405a5936763f83526baefb9f /gcc/cp | |
parent | 68aab9ee3e6ba21b48b5f2e24e61705472b7f7ed (diff) | |
download | gcc-65a5559bdf97989997b12c372ef4c77dd4740b19.zip gcc-65a5559bdf97989997b12c372ef4c77dd4740b19.tar.gz gcc-65a5559bdf97989997b12c372ef4c77dd4740b19.tar.bz2 |
re PR c++/9328 (ICE with templates and namespace std members)
PR c++/9328
* g++.dg/ext/typeof3.C: New test.
PR c++/9328
* error.c (dump_decl): For an OVERLOAD, just print the name of the
function; it doesn't make sense to try to print its type.
* semantics.c (finish_typeof): Issue errors about invalid uses.
From-SVN: r61631
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/cp/error.c | 19 | ||||
-rw-r--r-- | gcc/cp/semantics.c | 20 |
3 files changed, 38 insertions, 6 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index f871077..9be5f76 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,10 @@ 2003-01-22 Mark Mitchell <mark@codesourcery.com> + PR c++/9328 + * error.c (dump_decl): For an OVERLOAD, just print the name of the + function; it doesn't make sense to try to print its type. + * semantics.c (finish_typeof): Issue errors about invalid uses. + PR c++/9298 * parser.c (cp_parser_consume_semicolon_at_end_of_statement): New function. diff --git a/gcc/cp/error.c b/gcc/cp/error.c index d9bc552..d53943f 100644 --- a/gcc/cp/error.c +++ b/gcc/cp/error.c @@ -929,6 +929,25 @@ dump_decl (t, flags) break; case OVERLOAD: + if (OVL_CHAIN (t)) + { + t = OVL_CURRENT (t); + if (DECL_CLASS_SCOPE_P (t)) + { + dump_type (DECL_CONTEXT (t), flags); + output_add_string (scratch_buffer, "::"); + } + else if (DECL_CONTEXT (t)) + { + dump_decl (DECL_CONTEXT (t), flags); + output_add_string (scratch_buffer, "::"); + } + dump_decl (DECL_NAME (t), flags); + break; + } + + /* If there's only one function, just treat it like an ordinary + FUNCTION_DECL. */ t = OVL_CURRENT (t); /* Fall through. */ diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index adba8a5..19808e6 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -2136,20 +2136,28 @@ tree finish_typeof (expr) tree expr; { + tree type; + if (processing_template_decl) { - tree t; + type = make_aggr_type (TYPEOF_TYPE); + TYPE_FIELDS (type) = expr; - t = make_aggr_type (TYPEOF_TYPE); - TYPE_FIELDS (t) = expr; - - return t; + return type; } if (TREE_CODE (expr) == OFFSET_REF) expr = resolve_offset_ref (expr); - return TREE_TYPE (expr); + type = TREE_TYPE (expr); + + if (!type || type == unknown_type_node) + { + error ("type of `%E' is unknown", expr); + return error_mark_node; + } + + return type; } /* Compute the value of the `sizeof' operator. */ |