This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] Fix PR c++/17868


Compiling the following testcase with -pedantic, I get a hosed error message
with gcc 3.4.2:

=============================
struct A
{
    A(double);
};

const A& foo();

void bar(double x)
{
    foo()=A(x/2);
}
=============================

bug.cc: In function `void bar(double)':
bug.cc:10: error: no match for 'operator=' in 'foo() = A(#`rdiv_expr' not supported by dump_expr#<expression error>)'
bug.cc:2: note: candidates are: A& A::operator=(const A&) <near match>

The following trivial patch fixes that:


2004-10-06  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>

	PR c++/17868
	* error.c (dump_expr): Add missing case for RDIV_EXPR.


Index: error.c
===================================================================
RCS file: /usr/local/gcc/CVS/gcc-cvs/gcc/gcc/cp/error.c,v
retrieving revision 1.264
diff -u -p -r1.264 error.c
--- error.c	27 Sep 2004 12:10:14 -0000	1.264
+++ error.c	5 Oct 2004 15:34:07 -0000
@@ -1463,6 +1463,7 @@ dump_expr (tree t, int flags)
     case CEIL_DIV_EXPR:
     case FLOOR_DIV_EXPR:
     case ROUND_DIV_EXPR:
+    case RDIV_EXPR:
       dump_binary_op ("/", t, flags);
       break;
 
===================================================================

With the patch I get:

bug.cc: In function `void bar(double)':
bug.cc:10: error: no match for 'operator=' in 'foo() = A((x / 2.0e+0))'
bug.cc:2: note: candidates are: A& A::operator=(const A&) <near match>

The bug is present since gcc 3.3.1.
I did a bootstrap on the 3.3 branch, 3.4 branch and mainline.
The regression tests are under way.

OK for 3.3 branch (when unfrozen), 3.4 branch and mainline, if they pass?

Just for the record: the error message on mainline has another problem,
see PR 17867.

Regards,
Volker



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]