Re: [PATCH] C++: Add fix-it hints for -Wold-style-cast

2017-04-27 Thread Marek Polacek
On Thu, Apr 27, 2017 at 05:10:24PM -0400, David Malcolm wrote: > + /* First try const_cast. */ > + trial = build_const_cast (dst_type, orig_expr, 0 /* complain */); > + if (trial != error_mark_node) > +return "const_cast"; > + > + /* If that fails, try static_cast. */ > + trial = build_s

Re: [PATCH] C++: Add fix-it hints for -Wold-style-cast

2017-04-27 Thread Florian Weimer
* David Malcolm: > gcc/testsuite/ChangeLog: > * g++.dg/other/old-style-cast-fixits.C: New test case. Would it make sense to add a test cases for the non-fixable cases? That would be: void test_1 (const void *ptr) { foo *f = (foo *)ptr; } And: const bar b_inst; foo *f = (fo