This is the mail archive of the gcc-bugs@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]

[Bug c++/12433] New: Wrong error message


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.


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