This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: c++/7467: method & class w/same name gives unhelpful error.
- From: lerdsuwa at gcc dot gnu dot org
- To: ben at timing dot com, gcc-bugs at gcc dot gnu dot org, gcc-prs at gcc dot gnu dot org, nobody at gcc dot gnu dot org
- Date: 26 Oct 2002 14:47:08 -0000
- Subject: Re: c++/7467: method & class w/same name gives unhelpful error.
- Reply-to: lerdsuwa at gcc dot gnu dot org, ben at timing dot com, gcc-bugs at gcc dot gnu dot org, gcc-prs at gcc dot gnu dot org, nobody at gcc dot gnu dot org, gcc-gnats at gcc dot gnu dot org
Synopsis: method & class w/same name gives unhelpful error.
State-Changed-From-To: open->closed
State-Changed-By: lerdsuwa
State-Changed-When: Sat Oct 26 07:47:07 2002
State-Changed-Why:
Not a bug. The following is a correct version of your code.
First, you need to declare the class foo before using it.
Second, to distinguish between class foo and function foo,
you can use the scope operator "::".
#include <iostream>
class foo
{
public:
foo() {};
};
class A
{
public:
A() {};
void foo() {};
::foo bar;
};
int main()
{
A oink;
// gives same error as:
// B oink;
// (B not defn'd)
}
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=7467