[LLVMdev] [RFC] C++11: 'virtual' and 'override'

Chris Lattner clattner at apple.com
Tue Mar 4 22:59:33 PST 2014


On Mar 4, 2014, at 10:48 PM, Duncan Exon Smith <dexonsmith at apple.com> wrote:
>>>> 
>>>>> Related, should we require use of 'override' when methods override a base
>>>>> class method?
>>>> 
>>>> My vote: require override.
>>> 
>>> +1: override is useful and prevents errors.
>> Would it be too much to have clang emit a warning/error if override is missing?  I know that sounds crazy and people hate errors which fire too often, but there’s not too much C++11 code out there yet, and so we have a chance to put errors/warnings in now without too much pain.  People might just get used to them and think its how code has to be written :)
> 
> Might be a nightmare when including legacy headers, but warnings can always be disabled...

A clang warning for this would be awesome, but it should be off by default.  That said, the build of LLVM itself could detect that Clang had this warning and turn it on.  I think it would be great to have the makefiles/cmake detect modern clang's and turn on additional warnings that we can't inflict on the world by default.

-Chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140304/b45941fa/attachment.html>


More information about the llvm-dev mailing list