I'm surprised I can't find this reported already, apologies if it has been.

Given:

class A { int i; };

class B : public A { int f() { return i; } };

GCC 3.4 and up prints the same diagnostic twice:

access2.cc: In member function `int B::f()':
access2.cc:1: error: `int A::i' is private
access2.cc:3: error: within this context
access2.cc:1: error: `int A::i' is private
access2.cc:3: error: within this context

GCC 2.95 - 3.3 only printed the diagnostic once:

-- 
           Summary: [3.4,4.0 regression] Access violation diagnostic given
                    twice
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: redi at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org


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

Reply via email to