https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66365

            Bug ID: 66365
           Summary: Regression - GCC 5.1.0: Can't convert
                    std::basic_istream<char> to bool
           Product: gcc
           Version: 5.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: alex.schnaidt at gmail dot com
  Target Milestone: ---

Created attachment 35669
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35669&action=edit
preprocessed rand.cpp

After the update from gcc 4.9.2 to 5.1.0 the build of 'passwordsafe'[1] failed
with the following error:

g++ -std=c++11 -Wall -I../../core -I../.. `/usr/bin/wx-config --debug=no
--unicode=yes --inplace --cxxflags` -pthread -I/usr/include/ykpers-1   -O0 -g
-ggdb -DUNICODE -DDEBUG -c rand.cpp -o ../../../obj/unicodedebug/os/rand.o
rand.cpp: In function ‘bool pws_os::GetRandomData(void*, long unsigned int)’:
rand.cpp:38:45: error: cannot convert ‘std::basic_istream<char>::__istream_type
{aka std::basic_istream<char>}’ to ‘bool’ in return
   return is.read(static_cast<char *>(p), len);
                                             ^

This used to work with 4.9.2 and upstream[2] thinks this to be a compiler
issue. Unfortunately my c++ knowledge isn't good enough to come up with a short
example to reproduce it, the original code is at [3].

% gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-unknown-linux-gnu/5.1.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: /build/gcc-multilib/src/gcc-5-20150519/configure --prefix=/usr
--libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man
--infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/
--enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++ --enable-shared
--enable-threads=posix --enable-libmpx --with-system-zlib --with-isl
--enable-__cxa_atexit --disable-libunwind-exceptions --enable-clocale=gnu
--disable-libstdcxx-pch --disable-libssp --enable-gnu-unique-object
--enable-linker-build-id --enable-lto --enable-plugin
--enable-install-libiberty --with-linker-hash-style=gnu
--enable-gnu-indirect-function --enable-multilib --disable-werror
--enable-checking=release --with-default-libstdcxx-abi=c++98
Thread model: posix
gcc version 5.1.0 (GCC)

[1] http://sourceforge.net/projects/passwordsafe/
[2] https://sourceforge.net/p/passwordsafe/bugs/1251/
[3]
http://sourceforge.net/p/passwordsafe/git-code/ci/0.95.1BETA/tree/src/os/linux/rand.cpp

Reply via email to