This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
C++ PATCH: Fix PR 5293 (regression)
- From: Gabriel Dos Reis <gdr at integrable-solutions dot net>
- To: gcc-patches at gcc dot gnu dot org
- Cc: mark at codesourcery dot com
- Date: 07 Jul 2003 17:44:34 +0200
- Subject: C++ PATCH: Fix PR 5293 (regression)
- Organization: Integrable Solutions
This patchlet fixes PR C++/5293 which is a regression
Bootstrapped and regtested on an i686-pc-linux-gnu.
OK for branch and mainline?
-- Gaby
Index: cp/ChangeLog
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/ChangeLog,v
retrieving revision 1.3076.2.176
diff -p -r1.3076.2.176 ChangeLog
*** cp/ChangeLog 6 Jul 2003 22:02:14 -0000 1.3076.2.176
--- cp/ChangeLog 7 Jul 2003 15:43:42 -0000
***************
*** 1,3 ****
--- 1,8 ----
+ 2003-07-07 Gabriel Dos Reis <gdr@integrable-solutions.net>
+
+ PR c++/5293
+ * call.c (initialize_reference): Improve diagnostic.
+
2003-07-06 Mark Mitchell <mark@codesourcery.com>
PR c++/11345
Index: cp/call.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/call.c,v
retrieving revision 1.341.2.26
diff -p -r1.341.2.26 call.c
*** cp/call.c 1 Jul 2003 18:47:47 -0000 1.341.2.26
--- cp/call.c 7 Jul 2003 15:43:42 -0000
*************** make_temporary_var_for_ref_to_temp (tree
*** 6037,6046 ****
Return the converted expression. */
tree
! initialize_reference (type, expr, decl)
! tree type;
! tree expr;
! tree decl;
{
tree conv;
--- 6037,6043 ----
Return the converted expression. */
tree
! initialize_reference (tree type, tree expr, tree decl)
{
tree conv;
*************** initialize_reference (type, expr, decl)
*** 6050,6056 ****
conv = reference_binding (type, TREE_TYPE (expr), expr, LOOKUP_NORMAL);
if (!conv || ICS_BAD_FLAG (conv))
{
! error ("could not convert `%E' to `%T'", expr, type);
return error_mark_node;
}
--- 6047,6059 ----
conv = reference_binding (type, TREE_TYPE (expr), expr, LOOKUP_NORMAL);
if (!conv || ICS_BAD_FLAG (conv))
{
! const char *nonconst = (TYPE_QUALS (type) & TYPE_QUAL_CONST)
! ? "" : " non-const";
! const char *kind = real_lvalue_p (expr) ? "lvalue" : "rvalue";
!
! error ("invalid initialization of%s reference of type '%T' "
! "from an %s expression of type '%T'", nonconst, type,
! kind, TREE_TYPE (expr));
return error_mark_node;
}
Index: testsuite/ChangeLog
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/ChangeLog,v
retrieving revision 1.2261.2.221
diff -p -r1.2261.2.221 ChangeLog
*** testsuite/ChangeLog 7 Jul 2003 07:31:46 -0000 1.2261.2.221
--- testsuite/ChangeLog 7 Jul 2003 15:43:42 -0000
***************
*** 1,3 ****
--- 1,7 ----
+ 2003-07-07 Gabriel Dos Reis <gdr@integrable-solutions.net>
+
+ * g++.dg/template/ptrmem4.C (ready): Adjust.
+
2003-07-07 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
Eric Botcazou <ebotcazou@libertysurf.fr>
Index: testsuite/g++.dg/init/ref8.C
===================================================================
RCS file: testsuite/g++.dg/init/ref8.C
diff -N testsuite/g++.dg/init/ref8.C
*** /dev/null 1 Jan 1970 00:00:00 -0000
--- testsuite/g++.dg/init/ref8.C 7 Jul 2003 15:43:42 -0000
***************
*** 0 ****
--- 1,10 ----
+ struct A {
+ A operator=(const A&);
+ };
+
+ A operator*(A, A);
+
+ A& operator+=(A& a, const A& b)
+ {
+ return a = a * b; // { dg-error "non-const reference" }
+ }
Index: testsuite/g++.dg/template/ptrmem4.C
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/g++.dg/template/ptrmem4.C,v
retrieving revision 1.1.2.1
diff -p -r1.1.2.1 ptrmem4.C
*** testsuite/g++.dg/template/ptrmem4.C 31 Jan 2003 16:35:40 -0000 1.1.2.1
--- testsuite/g++.dg/template/ptrmem4.C 7 Jul 2003 15:43:42 -0000
*************** struct SpyExample
*** 16,20 ****
void SpyExample::ready()
{
! queryAliases(inputs); // { dg-error "convert" }
}
--- 16,20 ----
void SpyExample::ready()
{
! queryAliases(inputs); // { dg-error "invalid initialization" }
}