From: Mark Mitchell Date: Thu, 23 Jan 2003 00:30:27 +0000 (+0000) Subject: re PR c++/9328 (ICE with templates and namespace std members) X-Git-Tag: releases/gcc-3.2.2~97 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=94f9d8c513c066d4096892463a1bda101eee98d2;p=thirdparty%2Fgcc.git 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: r61634 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 54ede46c071e..d6debc3d457e 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,10 @@ +2003-01-22 Mark Mitchell + + 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. + 2003-01-21 Jeffrey D. Oldham PR c++/47 diff --git a/gcc/cp/error.c b/gcc/cp/error.c index 75b1b7033676..a0217ae4cb61 100644 --- a/gcc/cp/error.c +++ b/gcc/cp/error.c @@ -935,6 +935,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 a4842036d8d3..a6f9afb083f5 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -2079,20 +2079,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. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 13912c8ecea5..d837136964f5 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2003-01-22 Mark Mitchell + + PR c++/9328 + * g++.dg/ext/typeof3.C: New test. + 2003-01-10 Josef Zlomek * gcc.c-torture/compile/20030110-1.c: New test.