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

             Bug #: 54580
           Summary: 64-bit pointer to int cast fails
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: russell.wall...@gmail.com


int main() { return (int)""; }

a.cc: In function 'int main()':
a.cc:1:26: error: cast from 'const char*' to 'int' loses precision
[-fpermissive]

This should not be a warning let alone an error, because an explicit cast was
used (though it would do no harm to retain it as a warning under -Wextra if so
desired).

Note that the -fpermissive workaround suggested in the message won't be a
solution in all cases because this is going to trigger on code that was
originally written - along with its build scripts - on 32-bit systems; in many
cases the author of the code will no longer be available to fix the problem.

Using built-in specs.
COLLECT_GCC=x86_64-w64-mingw32-g++
COLLECT_LTO_WRAPPER=c:/mingw64/bin/../libexec/gcc/x86_64-w64-mingw32/4.7.0/lto-wrapper.exe
Target: x86_64-w64-mingw32
Configured with: ../../../build/gcc/src/configure --target=x86_64-w64-mingw32
--prefix=/c/bb/vista64-mingw32/mingw-x86-x86_64/build/build/root
--with-sysroot=/c/bb/vista64-mingw32/mingw-x86-x86_64/build/build/root
--enable-languages=all,obj-c++ --enable-fully-dynamic-string --disable-multilib
Thread model: win32
gcc version 4.7.0 20111220 (experimental) (GCC)

Reply via email to