From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22269 invoked by alias); 28 Oct 2007 21:05:12 -0000 Received: (qmail 22215 invoked by uid 48); 28 Oct 2007 21:05:03 -0000 Date: Sun, 28 Oct 2007 21:05:00 -0000 Subject: [Bug c++/33934] New: access control bug in member function templates X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "sutambe at yahoo dot com" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2007-10/txt/msg02525.txt.bz2 In the program snippet given below, line number 14 and 20 should have identical access privileges with respect to A::func(). But gcc 4.1.2 compiles line #14 just fine, whereas on line #20, it catches the error correctly. This bug is similar to bug #24118. 1 class A 2 { 3 protected: 4 void func () 5 { } 6 }; 7 8 class B: private A 9 { 10 public: 11 template 12 void foo () 13 { 14 void (A::*ptr)() = & A::func; 15 // Should not compile but compiles on gcc 4.1.2 16 } 17 18 void bar () 19 { 20 void (A::*ptr)() = & A::func; 21 // Should not compile and gcc throws error. 22 } 23 }; 24 int main (void) 25 { 26 B b; 27 b.foo(); 28 b.bar(); 29 } -- Summary: access control bug in member function templates Product: gcc Version: 4.1.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: sutambe at yahoo dot com GCC host triplet: SMP i686 i386 GNU/Linux Fedora Core Release 6 GCC target triplet: SMP i686 i386 GNU/Linux http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33934