unsigned msg = diag::err_bad_cxx_cast_generic;
TryCastResult tcr = TryConstCast(*this, CastExpr, CastTy, /*CStyle*/true,
msg);
+ if (tcr == TC_Success)
+ Kind = CastExpr::CK_NoOp;
+
if (tcr == TC_NotApplicable) {
// ... or if that is not possible, a static_cast, ignoring const, ...
tcr = TryStaticCast(*this, CastExpr, CastTy, /*CStyle*/true, R, msg,
--- /dev/null
+// RUN: clang-cc %s -emit-llvm -o %t
+
+// PR5248
+namespace PR5248 {
+struct A {
+ void copyFrom(const A &src);
+ void addRef(void);
+};
+
+void A::copyFrom(const A &src) {
+ ((A &)src).addRef();
+}
+}
+