[Bug c++/35370] New: Visibility of member of base template class lacking in derived template class

gcc-bugzilla at meta-dynamic dot com gcc-bugzilla@gcc.gnu.org
Mon Feb 25 19:44:00 GMT 2008


Please forgive me if in fact this is standards-compliant behavior.

Code:

template<class T> class B
    {
    protected:
        int f;
    };

template<class T> class D : public B<T>
    {
    public:
        void a() { this->f = 0; } // OK
        void b() {       f = 0; } // `f' was not declared in this scope
    };

Compiled with command (gcc 4.2.1 as distributed on Ubuntu):
gcc-4.2 -c foo.cc

Produces error:
foo.cc: In member function ‘void D<T>::b()’:
foo.cc:11: error: ‘f’ was not declared in this scope

Expected behavior:
Successful compilation (or, if this is in fact not legal, perhaps a more
specific diagnostic message)


-- 
           Summary: Visibility of member of base template class lacking in
                    derived template class
           Product: gcc
           Version: 4.2.1
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: gcc-bugzilla at meta-dynamic dot com
GCC target triplet: i486-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35370



More information about the Gcc-bugs mailing list