The following code should not compile:

struct A
{
  int foo(int);
};

struct B : public A
{
  int foo(long);
  // using A::foo;  // This would make it visible
};

struct C : public B
{
  using A::foo; // A::foo should not be visible
};

The problem should be that B::foo hides A::foo from class C. Clause 7.3.3/14 of
the C++ standard says the using declaration should not work, in this case -
class A is not a direct base class of class C. However, GCC 4.1.1 accepts it
with no diagnostic.


-- 
           Summary: Using declaration accepts non-visible members from base
                    classes
           Product: gcc
           Version: 4.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: andrew dot stubbs at st dot com


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

Reply via email to