simon_tatham added inline comments.

================
Comment at: clang/include/clang/AST/DeclObjC.h:208
   const ParmVarDecl *const *getParams() const {
-    return reinterpret_cast<const ParmVarDecl *const *>(ParamsAndSelLocs);
+    return const_cast<const ParmVarDecl *const *>(Params);
   }
----------------
simon_tatham wrote:
> tmatheson wrote:
> > I don't think you need the `const_cast`
> I put it in because I got a compile error otherwise!
> 
> It's because of the double indirection. You don't need a cast to turn a `Foo 
> *` into a `const Foo *`. But here, we're turning a `Foo *` into a `const Bar 
> *`, where `Foo` and `Bar` are pointer types to things of different constness.
... ok, no, removing the `const_cast` now, I don't get a compile error. In that 
case there must have been something else weird about the version of the code 
where I had to add it, but I can't reconstruct what.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D105498

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

Reply via email to