[Bug libstdc++/40273] New: [C++0x] Invalid conwersion to bool is reported

piotr dot wyderski at gmail dot com gcc-bugzilla@gcc.gnu.org
Wed May 27 15:18:00 GMT 2009


#include <stdio.h>
#include <functional>

int main(int argc, char *argv[]) {

    std::function<void* ()> f = 0;

    if (f != 0) {}

    return 0;
}


 gcc -std=gnu++0x testcase.cpp


$ gcc -std=gnu++0x testcase.cpp
In file included from
/opt/gcc-trunk/lib/gcc/i686-pc-cygwin/4.5.0/include/c++/fu
nctional:70,
                 from testcase.cpp:2:
/opt/gcc-trunk/lib/gcc/i686-pc-cygwin/4.5.0/include/c++/tr1_impl/functional: In
function 'bool std::operator!=(const std::function<_Signature>&,
std::_M_clear_t
ype*) [with _Signature = void*()]':
testcase.cpp:8:   instantiated from here
/opt/gcc-trunk/lib/gcc/i686-pc-cygwin/4.5.0/include/c++/tr1_impl/functional:2116
: error: could not convert '__f' to 'bool'


-- 
           Summary: [C++0x] Invalid conwersion to bool is reported
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: piotr dot wyderski at gmail dot com
  GCC host triplet: Cygwin/GCC-trunk rev. 147886


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40273



More information about the Gcc-bugs mailing list