re PR c++/22256 (diagnostic shows wrong type for conversion operator)

/cp
2007-08-10  Paolo Carlini  <pcarlini@suse.de>

	PR c++/22256
	* decl.c (check_special_function_return_type): Just error
	on return type specified for conversion operator.

/testsuite
2007-08-10  Paolo Carlini  <pcarlini@suse.de>

	PR c++/22256
	* g++.dg/conversion/op3.C: New.

From-SVN: r127331
This commit is contained in:
Paolo Carlini 2007-08-10 08:56:34 +00:00 committed by Paolo Carlini
parent d184f9d90b
commit caba20819a
4 changed files with 16 additions and 4 deletions

View file

@ -1,3 +1,9 @@
2007-08-10 Paolo Carlini <pcarlini@suse.de>
PR c++/22256
* decl.c (check_special_function_return_type): Just error
on return type specified for conversion operator.
2007-08-09 Daniel Berlin <dberlin@dberlin.org>
* typeck2.c (readonly_error): Handle general expressions.

View file

@ -6993,10 +6993,8 @@ check_special_function_return_type (special_function_kind sfk,
break;
case sfk_conversion:
if (type && !same_type_p (type, optype))
error ("operator %qT declared to return %qT", optype, type);
else if (type)
pedwarn ("return type specified for %<operator %T%>", optype);
if (type)
error ("return type specified for %<operator %T%>", optype);
type = optype;
break;

View file

@ -1,3 +1,8 @@
2007-08-10 Paolo Carlini <pcarlini@suse.de>
PR c++/22256
* g++.dg/conversion/op3.C: New.
2007-08-09 Tobias Burnus <burnus@net-b.de>
PR fortran/32987

View file

@ -0,0 +1,3 @@
// PR c++/22256
struct node { int* operator int*(); }; // { dg-error "return type specified" }