http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60894
Bug ID: 60894
Summary: Use of redundant struct keyword in virtual function
prototype combined with using statement causes
compilation error
Product: gcc
Version: 4.8.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: loose at astron dot nl
The code below causes a compilation error:
t.cc:15:6: error: prototype for ‘void D::doIt(B::S&)’ does not match any in
class ‘D’
class B
{
protected:
struct S {};
virtual void doIt(struct S& s) = 0;
};
class D : public B
{
public:
using B::S;
virtual void doIt(struct S& s);
};
void D::doIt(struct S& s)
{
(void)s;
}
This code compiles fine if I remove the redundant struct keyword in the virtual
function prototype. It also compiles fine if I remove the using declaration. It
seems as if the compiler thinks I'm forward declaring another struct S inside
the declaration of D::doIt().