]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/9328 (ICE with templates and namespace std members)
authorMark Mitchell <mark@codesourcery.com>
Thu, 23 Jan 2003 00:30:27 +0000 (00:30 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Thu, 23 Jan 2003 00:30:27 +0000 (00:30 +0000)
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

gcc/cp/ChangeLog
gcc/cp/error.c
gcc/cp/semantics.c
gcc/testsuite/ChangeLog

index 54ede46c071e35bc8b1110aae87c293495311573..d6debc3d457e6e446aba45dbaa903073ffa0e03d 100644 (file)
@@ -1,3 +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.
+
 2003-01-21  Jeffrey D. Oldham  <oldham@codesourcery.com>
 
        PR c++/47
index 75b1b703367663a77018f066e067e8096353d696..a0217ae4cb6152f0ca595af6888a7481b22a0668 100644 (file)
@@ -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.  */
 
index a4842036d8d317cac91df6d35ceb46a7df977ce2..a6f9afb083f5d7e94c65837734db0cda50d20000 100644 (file)
@@ -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.  */
index 13912c8ecea551a5bd45ff0e9c0a6a5a8b384ac9..d837136964f58a7bebf8bed80df1a4f1d4339e28 100644 (file)
@@ -1,3 +1,8 @@
+2003-01-22  Mark Mitchell  <mark@codesourcery.com>
+
+       PR c++/9328
+       * g++.dg/ext/typeof3.C: New test.
+
 2003-01-10  Josef Zlomek  <zlomekj@suse.cz>
 
        * gcc.c-torture/compile/20030110-1.c: New test.