From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14951 invoked by alias); 16 Nov 2012 22:25:49 -0000 Received: (qmail 14719 invoked by uid 48); 16 Nov 2012 22:25:31 -0000 From: "joerg at netbsd dot org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/55361] New: Access control in templates only happens when instantiating a method Date: Fri, 16 Nov 2012 22:25:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: joerg at netbsd dot org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 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: 2012-11/txt/msg01559.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55361 Bug #: 55361 Summary: Access control in templates only happens when instantiating a method Classification: Unclassified Product: gcc Version: 4.7.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned@gcc.gnu.org ReportedBy: joerg@netbsd.org Consider the following example: class C { bool blocked; }; template < class > struct F { void operator* () { C a; a.blocked; } }; int main() { F x; } The operator is violating the access specifications of C, but this isn't detected until it is actually used. Nothing in it depends on the template though, so this check should happen earlier.