[Mesa-dev] [PATCH 1/4] glsl: fix visit/visit_enter overloaded virtual function warnings

Ian Romanick idr at freedesktop.org
Wed May 31 22:49:46 UTC 2017


On 05/31/2017 06:09 AM, Emil Velikov wrote:
> On 31 May 2017 at 01:55, Ian Romanick <idr at freedesktop.org> wrote:
>> I don't understand these warnings, and I have even less understanding of
>> how "using" fixes them.  For example...
>>
>> On 05/30/2017 01:47 PM, Rob Herring wrote:
>>> clang gives warnings about overloaded virtual functions:
>>>
>>> src/compiler/glsl/linker.cpp:244:30: warning: '(anonymous namespace)::array_resize_visitor::visit' hides overloaded virtual function [-Woverloaded-virtual]
>>>    virtual ir_visitor_status visit(ir_variable *var)
>>>                              ^
>>> src/compiler/glsl/linker.cpp:195:30: note: hidden overloaded virtual function '(anonymous namespace)::deref_type_updater::visit' declared here: type mismatch at 1st parameter ('ir_dereference_variable *' vs 'ir_variable *')
>>>    virtual ir_visitor_status visit(ir_dereference_variable *ir)
>>>                              ^
>>
>> This is weird and confusing.  ir_hierarchical_visitor has a virtual
>> visit(class ir_dereference_variable *) method.  The complaint about the
>> type seems... bizarre.
>>
> Since it took me a second to click here is my take on it:
> 
> The "base" class deref_type_updater has
>    virtual ir_visitor_status visit(ir_variable *var)
> 
> ... while the derived one class array_resize_visitor
>    virtual ir_visitor_status visit(ir_dereference_variable *ir)
> 
> ... hence the type mismatch.

Right... but deref_type_updater is derived from ir_hierarchical_visitor,
and that has virtual ir_visitor_status visit(ir_dereference_variable
*ir).  That is the function being overridden.

> I think Samuel is spot on here - we might want to keep it as-is until
> one gets the chance to address correctly.
> 
> -Emil


More information about the mesa-dev mailing list