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

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


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