]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/11670 (ICE in convert_like_real on illegal code)
authorNathan Sidwell <nathan@codesourcery.com>
Sun, 10 Aug 2003 14:59:58 +0000 (14:59 +0000)
committerNathan Sidwell <nathan@gcc.gnu.org>
Sun, 10 Aug 2003 14:59:58 +0000 (14:59 +0000)
cp:
PR c++/11670
* call.c (convert_like_real): Add rvalue binding error message.
* error.c (dump_expr) <NOP_EXPR case>: Detect when the no expr is
really a cast.
testsuite:
PR c++/11670
* g++.dg/expr/cast2.C: New test.

From-SVN: r70294

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

index 4db8e19ede84e357c1309e297f01685757849136..c4a59498cad2959f86d5b9760c5e2dd62d1c1fc6 100644 (file)
@@ -1,5 +1,10 @@
 2003-08-10  Nathan Sidwell  <nathan@codesourcery.com>
 
+       PR c++/11670
+       * call.c (convert_like_real): Add rvalue binding error message.
+       * error.c (dump_expr) <NOP_EXPR case>: Detect when the no expr is
+       really a cast.
+       
        PR c++/10530
        * pt.c (dependent_type_p_r): A dependent template-id is a class
        type with dependent template arguments, or a bound template
index e77aaee84421d7b94603a86eb3481ecdd79213fb..73c8c44ea79ecb498fd42809d42f210d65758af1 100644 (file)
@@ -4133,7 +4133,7 @@ convert_like_real (tree convs, tree expr, tree fn, int argnum, int inner,
                  error ("cannot bind packed field `%E' to `%T'",
                         expr, ref_type);
                else
-                 my_friendly_assert (0, 20030715);
+                 error ("cannot bind rvalue `%E' to `%T'", expr, ref_type);
                return error_mark_node;
              }
            expr = build_target_expr_with_type (expr, type);
index cb31703365868c4ae481a46e8a25fbe879a526c0..3531f94ec8aa4c4e1c63076313cffc4dbc0e7bec 100644 (file)
@@ -1682,9 +1682,27 @@ dump_expr (tree t, int flags)
       break;
 
     case NOP_EXPR:
-      dump_expr (TREE_OPERAND (t, 0), flags);
-      break;
-
+      {
+       tree op = TREE_OPERAND (t, 0);
+       
+       if (!same_type_p (TREE_TYPE (op), TREE_TYPE (t)))
+         {
+           /* It is a cast, but we cannot tell whether it is a
+              reinterpret or static cast. Use the C style notation.  */
+           if (flags & TFF_EXPR_IN_PARENS)
+             pp_left_paren (cxx_pp);
+           pp_left_paren (cxx_pp);
+           dump_type (TREE_TYPE (t), flags);
+           pp_right_paren (cxx_pp);
+           dump_expr (op, flags | TFF_EXPR_IN_PARENS);
+           if (flags & TFF_EXPR_IN_PARENS)
+             pp_right_paren (cxx_pp);
+         }
+       else
+         dump_expr (op, flags);
+       break;
+      }
+      
     case EXPR_WITH_FILE_LOCATION:
       dump_expr (EXPR_WFL_NODE (t), flags);
       break;
index 34e5185272b7831ed97b0d246373f10b4636b151..efdfe31f3a2a014086c4a48b4d90655374b55328 100644 (file)
@@ -1,5 +1,8 @@
 2003-08-10  Nathan Sidwell  <nathan@codesourcery.com>
 
+       PR c++/11670
+       * g++.dg/expr/cast2.C: New test.
+       
        PR c++/10530
        * g++.dg/template/dependent-name2.C: New test.