Jump to content
  • Advertisement
Sign in to follow this  
Crispweed

strangeness in gcc 4.0

This topic is 4775 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

template <class TRAITS>
class cBase
{
public:
    long dataMember;
};
template <class TRAITS>
class cDerived : public cBase<TRAITS>
{
public:

    void foo()
    {
        cBase<TRAITS>::dataMember = 5; // this works ok
        this->dataMember = 5; // this works ok
        dataMember = 5; // this causes an error with dataMember not found
    }
};

When I attempt to compile this I get: Test.cpp:17 error: 'dataMember' was not declared in this scope Has anyone had similar problems in gcc 4.0? If someone else here is using gcc 4.0 please try compiling this and see if you get the same problem..

Share this post


Link to post
Share on other sites
Advertisement

Ok, apparently this is how it is supposed to work:

from http://gcc.gnu.org/gcc-3.4/changes.html:

"In a template definition, unqualified names will no longer find members of a dependent base (as specified by [temp.dep]/3 in the C++ standard). "

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!