[cfe-commits] [PATCH 02/15] Fix Cast

Dmitri Gribenko gribozavr at gmail.com
Thu Jan 10 11:44:40 PST 2013


On Thu, Jan 10, 2013 at 9:12 PM, David Greene <dag at cray.com> wrote:
> Avoid a cast-away-const error by properly using const_cast<>.

-  return forallBases(BaseIsNot, (void*) Base->getCanonicalDecl());
+  return forallBases(BaseIsNot,
+                     const_cast<CXXRecordDecl *>(Base->getCanonicalDecl()));

LGTM, but a better solution would be to add an overload to
forallBases() with const void * to hide this cast there.

Dmitri

-- 
main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
(j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/



More information about the cfe-commits mailing list