This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: c++/7467: method & class w/same name gives unhelpful error.


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]