olestrohm added inline comments.

================
Comment at: clang/test/SemaCXX/warn-reinterpret-base-class.cpp:301
 
-  // expected-warning@+2 {{'reinterpret_cast' to class 'L' (aka 'const F 
*volatile') from its base at non-zero offset 'E *' behaves differently from 
'static_cast'}}
+  // expected-warning@+2 {{'reinterpret_cast' to class 'K' (aka 'const F *') 
from its base at non-zero offset 'E *' behaves differently from 'static_cast'}}
   // expected-note@+1 {{use 'static_cast' to adjust the pointer correctly 
while downcasting}}
----------------
Anastasia wrote:
> I wonder if there is a way to track the original type for the diagnostic? Or 
> maybe it is intuitive enough considering the quoted spec wording...
This actually already happens with the source type too.
const short s = 0;
reinterpret_cast<int>(s);

gives the error "reinterpret_cast from 'short' to 'int' is not allowed", so 
while this is definitely worse, it's a general problem with reinterpret_cast.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D102689/new/

https://reviews.llvm.org/D102689

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to