[cfe-dev] C++ Casting Error Messages

Bill Wendling isanbard at gmail.com
Mon Aug 13 21:55:42 PDT 2007


Hi all,

I was wondering what the wording of the error messages for C++ casts  
should be. Right now, I have them as:

t.cpp:
int volatile * const * ip;
float const * const * fpp = reinterpret_cast<float const * const *>(ip);
float const * volatile * fpv = reinterpret_cast<float const *  
volatile *>(ip);
float const * volatile * const * fpvc = reinterpret_cast<float const  
* volatile * const *>\
(ip);

$ clang -parse-ast-print t.cpp
t.cpp:2:29: error: reinterpret_cast from type 'int volatile *const *'  
to type 'float const\
*const *' casts away constness
float const * const * fpp = reinterpret_cast<float const * const *>(ip);
                             ^~~~~~~~~~~~~~~~
t.cpp:3:32: error: reinterpret_cast from type 'int volatile *const *'  
to type 'float const\
*volatile *' casts away constness
float const * volatile * fpv = reinterpret_cast<float const *  
volatile *>(ip);
                                ^~~~~~~~~~~~~~~~
What do you think?

-bw



More information about the cfe-dev mailing list