Skip to content

spurious warning on overloaded-virtual #9554

@llvmbot

Description

@llvmbot
Bugzilla Link 9182
Resolution FIXED
Resolved on Feb 10, 2011 12:14
Version trunk
OS Linux
Reporter LLVM Bugzilla Contributor
CC @akyrtzi,@DougGregor

Extended Description

This code warns that the derived class hides a virtual function -- except that it doesn't:

struct Base {
virtual void foo(int);
};

void Base::foo(int) { }

struct Derived : public Base {
virtual void foo(int);
void foo(int, int);
};

note that if you move the out-of-line Base::foo def'n after struct Derived, then it doesn't warn any more. Here's the clang output:

$ clang++ -c x.cc -Woverloaded-virtual
x.cc:9:8: warning: 'Derived::foo' hides overloaded virtual function
[-Woverloaded-virtual]
void foo(int, int);
^
x.cc:5:12: note: hidden overloaded virtual function 'Base::foo' declared here
void Base::foo(int) { }
^
1 warning generated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugzillaIssues migrated from bugzillac++

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions