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
* 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
Volker's patch for -Wold-style-cast inspired me to add a fix-it hint
for when this warning fires, which converts the C-style cast to
a C++-style cast.
It tries to find a legal C++-style cast, trying them in the order:
const_cast, static_cast, reinterpret_cast. It doesn't try
dynamic_cast. It cal