[PATCH] Fix for Bug 7256 - clang++ should provide a fix-it hint for incorrect destructor declarations
Dmitri Gribenko
gribozavr at gmail.com
Mon Feb 18 15:25:12 PST 2013
On Tue, Feb 19, 2013 at 1:06 AM, Ismail Pazarbasi
<ismail.pazarbasi at gmail.com> wrote:
> On Mon, Feb 18, 2013 at 10:51 PM, Dmitri Gribenko <gribozavr at gmail.com> wrote:
>> On Mon, Feb 18, 2013 at 11:40 PM, Ismail Pazarbasi
>> <ismail.pazarbasi at gmail.com> wrote:
>>> Hi,
>>>
>>> I have made this a while ago, but didn't have a chance to submit it.
>>>
>>> When an invalid destructor name is found within a class scope, a
>>> fix-it hint will be issued to correct the destructor name so that it
>>> matches the class name.
>>
>> We have a way to test fixit text directly
>> (-fdiagnostics-parseable-fixits). See test/FixIt/typo.c for an
>> example.
>
> Thank you for the reference; I might have used that instead, but I
> have moved my test into test/FixIt/fixit.cpp, and I didn't touch the
> RUN instruction.
I would still ask to add -fdiagnostics-parseable-fixits to this test.
The issue is that we could easily get it wrong: for example, when we
change the source range of the destructor name to cover the whole
'~bar' (there's another thread about it right now). Replacing that
would turn a destructor into a constructor. Of course, it would
compile cleanly, but it would be semantically wrong.
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