From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19450 invoked by alias); 21 Jan 2009 16:15:19 -0000 Received: (qmail 19287 invoked by alias); 21 Jan 2009 16:15:07 -0000 Date: Wed, 21 Jan 2009 16:15:00 -0000 Message-ID: <20090121161507.19286.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug c++/26693] [4.2/4.3/4.4 regression] Access checks not performed for types in templates In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "dodji at gcc dot gnu dot org" 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: 2009-01/txt/msg02288.txt.bz2 ------- Comment #8 from dodji at gcc dot gnu dot org 2009-01-21 16:15 ------- Subject: Bug 26693 Author: dodji Date: Wed Jan 21 16:14:49 2009 New Revision: 143546 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=143546 Log: gcc/ChangeLog: 2009-01-21 Dodji Seketeli PR c++/26693 * c-decl.c: (clone_underlying_type): Move this ... * c-common.c (set_underlying_type): ... here. Also, make sure the function properly sets TYPE_STUB_DECL() on the newly created typedef variant type. (is_typedef_decl ): New entry point. * tree.h: Added a new member member_types_needing_access_check to struct tree_decl_non_common. (set_underlying_type): New entry point. (is_typedef_type): Likewise. gcc/cp/ChangeLog/ 2009-01-21 Dodji Seketeli PR c++/26693 * decl2.c (grokfield): when a typedef appears in a class, create the typedef variant type node for it. (save_template_attributes): Creating typedef variant type node here is now useless. * decl.c (grokdeclarator): If the typedef'ed struct/class was anonymous, set the proper type name to all its type variants. * name-lookup.c (pushdecl_maybe_friend): Reuse the set_underlying_type function to install typedef variant types. * cp-tree.h (MEMBER_TYPES_NEEDING_ACCESS_CHECK): New template accessor macro. (append_type_to_template_for_access_check): New entry points. * semantics.c (check_accessibility_of_qualified_id): When a typedef that is a member of a class appears in a template, add it to the template. It will be ... * pt.c (instantiate_class_template, instantiate_template ): ... access checked at template instantiation time. (tsubst): Handle the case of being called with NULL args. (resolve_type_name_type): The type name should be the name of the main type variant. (append_type_to_template_for_access_check): New entry point. gcc/testsuite/ChangeLog 2009-01-21 Dodji Seketeli PR c++/26693 * g++.dg/template/typedef11.C: New test. * g++.dg/template/typedef12.C: Likewise. * g++.dg/template/typedef13.C: Likewise. * g++.dg/template/typedef14.C: Likewise. * g++.dg/template/sfinae3.C: Compile this pedantically. The only errors expected should be the one saying the typedef is ill formed. * g++.old-deja/g++.pt/typename8.C: Likewise. * g++.dg/template/access11.C: Update this. libstdc++-v3/ChangeLog: 2009-01-21 Dodji Seketeli * include/ext/bitmap_allocator.h: the typedefs should be made public if we want them to be accessible. This has been revealed by the patch that fixes PR c++/26693 in g++. Added: trunk/gcc/testsuite/g++.dg/template/typedef11.C trunk/gcc/testsuite/g++.dg/template/typedef12.C trunk/gcc/testsuite/g++.dg/template/typedef13.C trunk/gcc/testsuite/g++.dg/template/typedef14.C Modified: trunk/gcc/ChangeLog trunk/gcc/c-common.c trunk/gcc/c-decl.c trunk/gcc/cp/ChangeLog trunk/gcc/cp/cp-tree.h trunk/gcc/cp/decl.c trunk/gcc/cp/decl2.c trunk/gcc/cp/name-lookup.c trunk/gcc/cp/pt.c trunk/gcc/cp/semantics.c trunk/gcc/testsuite/ChangeLog trunk/gcc/testsuite/g++.dg/template/access11.C trunk/gcc/testsuite/g++.dg/template/sfinae3.C trunk/gcc/testsuite/g++.old-deja/g++.pt/typename8.C trunk/gcc/tree.h trunk/libstdc++-v3/ChangeLog trunk/libstdc++-v3/include/ext/bitmap_allocator.h -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26693