]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[multiple changes]
authorJason Merrill <jason@gcc.gnu.org>
Wed, 8 Oct 1997 06:04:28 +0000 (02:04 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Wed, 8 Oct 1997 06:04:28 +0000 (02:04 -0400)
Tue Oct  7 23:00:12 1997  Mark Mitchell  <mmitchell@usa.net>

* decl.c (make_typename_type): Do not try to call lookup_field for
non-aggregate types.

Tue Oct  7 22:52:10 1997  Jason Merrill  <jason@yorick.cygnus.com>

* typeck.c (build_reinterpret_cast): Tweak.

Tue Oct  7 22:45:31 1997  Alexandre Oliva  <oliva@dcc.unicamp.br>

* typeck.c (build_reinterpret_cast): converting a void pointer
to function pointer with a reinterpret_cast produces a warning
if -pedantic is issued

Tue Oct  7 22:43:43 1997  Bruno Haible  <bruno@linuix.mathematik.uni-karlsruhe.de>

* typeck.c (c_expand_return): Don't warn about returning a
reference-type variable as a reference.

From-SVN: r15876

gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/cp/typeck.c

index 712e118500e9640f96b9d93b57da06891e3593a1..b3d17955340fd6088e8b5ef2c6e3cc9fd23ad581 100644 (file)
@@ -1,3 +1,23 @@
+Tue Oct  7 23:00:12 1997  Mark Mitchell  <mmitchell@usa.net>
+
+       * decl.c (make_typename_type): Do not try to call lookup_field for
+       non-aggregate types.
+
+Tue Oct  7 22:52:10 1997  Jason Merrill  <jason@yorick.cygnus.com>
+
+       * typeck.c (build_reinterpret_cast): Tweak.
+
+Tue Oct  7 22:45:31 1997  Alexandre Oliva  <oliva@dcc.unicamp.br>
+
+       * typeck.c (build_reinterpret_cast): converting a void pointer
+       to function pointer with a reinterpret_cast produces a warning
+       if -pedantic is issued
+
+Tue Oct  7 22:43:43 1997  Bruno Haible  <bruno@linuix.mathematik.uni-karlsruhe.de>
+
+       * typeck.c (c_expand_return): Don't warn about returning a
+       reference-type variable as a reference.
+
 Tue Oct  7 21:11:22 1997  Jason Merrill  <jason@yorick.cygnus.com>
 
        * method.c (build_static_name): Fix typo.
index 4f6f982237b8450551b994d2dd30b4641330554f..9c896706875293eebbc45df8e8592706e75966dd 100644 (file)
@@ -4349,7 +4349,11 @@ make_typename_type (context, name)
   if (! uses_template_parms (context)
       || context == current_class_type)
     {
-      t = lookup_field (context, name, 0, 1);
+      if (IS_AGGR_TYPE (context))
+       t = lookup_field (context, name, 0, 1);
+      else
+       t = NULL_TREE;
+
       if (t == NULL_TREE)
        {
          cp_error ("no type named `%#T' in `%#T'", name, context);
index 797cd3d4c3e5f3b4bf0fe37b89595b6d1a7a2ca2..96d1c26e3e868567ef657c74d040e0a0e5402a91 100644 (file)
@@ -5380,6 +5380,14 @@ build_reinterpret_cast (type, expr)
        expr = decl_constant_value (expr);
       return fold (build1 (NOP_EXPR, type, expr));
     }
+  else if ((TYPE_PTRFN_P (type) && TYPE_PTROBV_P (intype))
+          || (TYPE_PTRFN_P (type) && TYPE_PTROBV_P (intype)))
+    {
+      pedwarn ("ANSI C++ forbids casting between pointers to functions and objects");
+      if (TREE_READONLY_DECL_P (expr))
+       expr = decl_constant_value (expr);
+      return fold (build1 (NOP_EXPR, type, expr));
+    }
   else
     {
       cp_error ("reinterpret_cast from `%T' to `%T'", intype, type);
@@ -7298,7 +7306,8 @@ c_expand_return (retval)
            {
              if (TEMP_NAME_P (DECL_NAME (whats_returned)))
                warning ("reference to non-lvalue returned");
-             else if (! TREE_STATIC (whats_returned)
+             else if (TREE_CODE (TREE_TYPE (whats_returned)) != REFERENCE_TYPE
+                      && ! TREE_STATIC (whats_returned)
                       && IDENTIFIER_LOCAL_VALUE (DECL_NAME (whats_returned))
                       && !TREE_PUBLIC (whats_returned))
                cp_warning_at ("reference to local variable `%D' returned", whats_returned);