public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/22256] diagnostic shows wrong type for cast operator
[not found] <bug-22256-6594@http.gcc.gnu.org/bugzilla/>
@ 2007-08-06 11:52 ` pcarlini at suse dot de
2007-08-10 8:57 ` [Bug c++/22256] diagnostic shows wrong type for conversion operator paolo at gcc dot gnu dot org
2007-08-10 8:58 ` pcarlini at suse dot de
2 siblings, 0 replies; 8+ messages in thread
From: pcarlini at suse dot de @ 2007-08-06 11:52 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from pcarlini at suse dot de 2007-08-06 11:52 -------
The subtle issue here is that this specific error message should be emitted
*only* when the incorrectly specified return type doesn't match, thus a plain
error instead of a pedwarn:
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);
type = optype;
but for some reason the thing doesn't work... I'm looking a bit into it.
--
pcarlini at suse dot de changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |pcarlini at suse dot de
|dot org |
Status|NEW |ASSIGNED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22256
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/22256] diagnostic shows wrong type for conversion operator
[not found] <bug-22256-6594@http.gcc.gnu.org/bugzilla/>
2007-08-06 11:52 ` [Bug c++/22256] diagnostic shows wrong type for cast operator pcarlini at suse dot de
@ 2007-08-10 8:57 ` paolo at gcc dot gnu dot org
2007-08-10 8:58 ` pcarlini at suse dot de
2 siblings, 0 replies; 8+ messages in thread
From: paolo at gcc dot gnu dot org @ 2007-08-10 8:57 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from paolo at gcc dot gnu dot org 2007-08-10 08:56 -------
Subject: Bug 22256
Author: paolo
Date: Fri Aug 10 08:56:34 2007
New Revision: 127331
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=127331
Log:
/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.
Added:
trunk/gcc/testsuite/g++.dg/conversion/op3.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/decl.c
trunk/gcc/testsuite/ChangeLog
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22256
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/22256] diagnostic shows wrong type for conversion operator
[not found] <bug-22256-6594@http.gcc.gnu.org/bugzilla/>
2007-08-06 11:52 ` [Bug c++/22256] diagnostic shows wrong type for cast operator pcarlini at suse dot de
2007-08-10 8:57 ` [Bug c++/22256] diagnostic shows wrong type for conversion operator paolo at gcc dot gnu dot org
@ 2007-08-10 8:58 ` pcarlini at suse dot de
2 siblings, 0 replies; 8+ messages in thread
From: pcarlini at suse dot de @ 2007-08-10 8:58 UTC (permalink / raw)
To: gcc-bugs
------- Comment #8 from pcarlini at suse dot de 2007-08-10 08:57 -------
Fixed for 4.3.0.
--
pcarlini at suse dot de changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
Target Milestone|--- |4.3.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22256
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/22256] diagnostic shows wrong type for cast operator
2005-06-30 16:30 [Bug c++/22256] New: diagnostic shows wrong type igodard at pacbell dot net
` (2 preceding siblings ...)
2005-06-30 21:48 ` igodard at pacbell dot net
@ 2005-06-30 22:11 ` gdr at integrable-solutions dot net
3 siblings, 0 replies; 8+ messages in thread
From: gdr at integrable-solutions dot net @ 2005-06-30 22:11 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From gdr at integrable-solutions dot net 2005-06-30 22:11 -------
Subject: Re: diagnostic shows wrong type for cast operator
"igodard at pacbell dot net" <gcc-bugzilla@gcc.gnu.org> writes:
| Gabriel: no, it also happens with any pointer:
|
| struct node { float* operator float*(); };
|
| gets you:
|
| foo.cc:1: error: operator `float*' declared to return `float'
Alright, that was a wrong guess.
-- Gaby
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22256
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Bug c++/22256] diagnostic shows wrong type for cast operator
2005-06-30 21:48 ` igodard at pacbell dot net
@ 2005-06-30 22:11 ` Gabriel Dos Reis
0 siblings, 0 replies; 8+ messages in thread
From: Gabriel Dos Reis @ 2005-06-30 22:11 UTC (permalink / raw)
To: gcc-bugzilla; +Cc: gcc-bugs
"igodard at pacbell dot net" <gcc-bugzilla@gcc.gnu.org> writes:
| Gabriel: no, it also happens with any pointer:
|
| struct node { float* operator float*(); };
|
| gets you:
|
| foo.cc:1: error: operator `float*' declared to return `float'
Alright, that was a wrong guess.
-- Gaby
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/22256] diagnostic shows wrong type for cast operator
2005-06-30 16:30 [Bug c++/22256] New: diagnostic shows wrong type igodard at pacbell dot net
2005-06-30 17:45 ` [Bug c++/22256] diagnostic shows wrong type for cast operator pinskia at gcc dot gnu dot org
2005-06-30 20:56 ` gdr at integrable-solutions dot net
@ 2005-06-30 21:48 ` igodard at pacbell dot net
2005-06-30 22:11 ` Gabriel Dos Reis
2005-06-30 22:11 ` gdr at integrable-solutions dot net
3 siblings, 1 reply; 8+ messages in thread
From: igodard at pacbell dot net @ 2005-06-30 21:48 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From igodard at pacbell dot net 2005-06-30 21:48 -------
Gabriel: no, it also happens with any pointer:
struct node { float* operator float*(); };
gets you:
foo.cc:1: error: operator `float*' declared to return `float'
And similarly for other types including classes (not shown).
BTW, shouldn't the title be "diagnostic shows wrong type for conversion
function" ? I've never heard these called "cast operators".
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22256
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/22256] diagnostic shows wrong type for cast operator
2005-06-30 16:30 [Bug c++/22256] New: diagnostic shows wrong type igodard at pacbell dot net
2005-06-30 17:45 ` [Bug c++/22256] diagnostic shows wrong type for cast operator pinskia at gcc dot gnu dot org
@ 2005-06-30 20:56 ` gdr at integrable-solutions dot net
2005-06-30 21:48 ` igodard at pacbell dot net
2005-06-30 22:11 ` gdr at integrable-solutions dot net
3 siblings, 0 replies; 8+ messages in thread
From: gdr at integrable-solutions dot net @ 2005-06-30 20:56 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From gdr at integrable-solutions dot net 2005-06-30 20:56 -------
Subject: Re: diagnostic shows wrong type
"bangerth at dealii dot org" <gcc-bugzilla@gcc.gnu.org> writes:
| Confirmed. Also happens with 3.3.x.
I think this happens because when the C++ front-end finds that a
declaration is erroneous, it sets its TREE_TYPE to "int", presumably
thinking that a default type should be "int".
-- Gaby
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22256
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/22256] diagnostic shows wrong type for cast operator
2005-06-30 16:30 [Bug c++/22256] New: diagnostic shows wrong type igodard at pacbell dot net
@ 2005-06-30 17:45 ` pinskia at gcc dot gnu dot org
2005-06-30 20:56 ` gdr at integrable-solutions dot net
` (2 subsequent siblings)
3 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-06-30 17:45 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
Severity|normal |enhancement
Keywords| |diagnostic
Known to fail| |2.95 3.0.4 3.2.2 4.0.0 3.4.0
| |3.3.3
Summary|diagnostic shows wrong type |diagnostic shows wrong type
| |for cast operator
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22256
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2007-08-10 8:58 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <bug-22256-6594@http.gcc.gnu.org/bugzilla/>
2007-08-06 11:52 ` [Bug c++/22256] diagnostic shows wrong type for cast operator pcarlini at suse dot de
2007-08-10 8:57 ` [Bug c++/22256] diagnostic shows wrong type for conversion operator paolo at gcc dot gnu dot org
2007-08-10 8:58 ` pcarlini at suse dot de
2005-06-30 16:30 [Bug c++/22256] New: diagnostic shows wrong type igodard at pacbell dot net
2005-06-30 17:45 ` [Bug c++/22256] diagnostic shows wrong type for cast operator pinskia at gcc dot gnu dot org
2005-06-30 20:56 ` gdr at integrable-solutions dot net
2005-06-30 21:48 ` igodard at pacbell dot net
2005-06-30 22:11 ` Gabriel Dos Reis
2005-06-30 22:11 ` gdr at integrable-solutions dot net
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).