This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/12433] New: Wrong error message
- From: "igodard at pacbell dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 27 Sep 2003 20:57:56 -0000
- Subject: [Bug c++/12433] New: Wrong error message
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12433
Summary: Wrong error message
Product: gcc
Version: 3.3.1
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: igodard at pacbell dot net
CC: gcc-bugs at gcc dot gnu dot org
The example attempts to output the result of dereferencing a function and (for contrast) dererencing a function pounter, and produces a warning about "address will always be true".
Attempts to deref a function/function pointer in other contexts gets a warning "result will be a reference, not a call", as shown later in the example, which is fine. Such a warning in the output statement would also be fine.
The example code "cout << *Bar" should first (automatically) promote Bar to "int(*)()", then dereference that to "int()" (possibly with the warning about the result being a reference), then automatically promote the result back to "int(*)()" and pass that pointer to std::operator<<. As std::operator<< is templated for any pointer type it should display the hex address of (the first instruction of) Bar on cout. Nowhere should this be converted to bool, and the issued warning is bogus.