weixin_39822993 2020-11-30 11:25
浏览 0

types used in functions marked "override" need not have the corresponding header included

Originally reported on Google Code with ID 105


1. Run IWYU on a subclass that overrides a virtual function that uses a type, and has
the c++11 override specifier.
2. IWYU suggests that the subclass should provide an include for the type in the overridden
method.

> What is the expected output? What do you see instead?

The base class header file must somehow include the type, and so the subclass header
is guaranteed to have a definition of the type since it must include the base header
(otherwise "override" will cause an error).  Therefore it is redundant to include the
type's header in the subclass.

> What version of the product are you using? On what operating system?

SVN linux build from 2013-08-27.

Reported by mostynb.com on 2013-08-29 20:05:21

该提问来源于开源项目:include-what-you-use/include-what-you-use

  • 写回答

20条回答 默认 最新

  • weixin_39822993 2020-11-30 11:25
    关注
    
    Thanks, the example makes sense. It sounds like if we can prove that a method is an
    override (with or without C++11 override), we can ignore its arguments in IWYU analysis.
    Does that sound about right?
    
    

    Reported by kim.grasman on 2013-08-29 20:14:26

    评论

报告相同问题?