This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
throw bug with 64-bit compiles
- From: "John (Eljay) Love-Jensen" <eljay at adobe dot com>
- To: GCC-help <gcc-help at gcc dot gnu dot org>
- Date: Fri, 27 Mar 2009 08:15:50 -0700
- Subject: throw bug with 64-bit compiles
Hi everyone,
I am using GCC 4.0.1 (Apple's build), and -m64 for x86_64.
I am seeing two puzzling warnings...
test.cpp:21: warning: implicit conversion shortens 64-bit value into a 32-bit value
test.cpp:21: warning: implicit conversion shortens 64-bit value into a 32-bit value
# gcc --version
i686-apple-darwin9-gcc-4.0.1 (GCC) 4.0.1 (Apple Inc. build 5490)
I wrote a minimal test case.
# cat test.cpp
// g++ -Wshorten-64-to-32 -m64 -c test.cpp
struct Alpha
{
};
struct Beta
{
};
struct Delta
:
public Alpha,
public Beta
{
void rethrow() const;
};
void Delta::rethrow() const
{
throw *this; // <-- two warnings generated here.
}
// end of test.cpp
Any thoughts as to why the warning is being emitted?
Are the warnings relatively benign and ignorable? Or need I be alarmed (and any workarounds)?
Thanks,
--Eljay