summaryrefslogtreecommitdiff
path: root/gcc/cp/name-lookup.c
diff options
context:
space:
mode:
authordodji <dodji@138bc75d-0d04-0410-961f-82ee72b054a4>2009-01-21 16:14:49 +0000
committerdodji <dodji@138bc75d-0d04-0410-961f-82ee72b054a4>2009-01-21 16:14:49 +0000
commitc973dc474cd1b69ca06baf40f0590dc6dbfb4645 (patch)
tree9c26f4fbfa6128e66099ace4205d1bd99cc4c3a3 /gcc/cp/name-lookup.c
parentedfaa9e32e6d661b3a582467caa17295d7f75288 (diff)
downloadgcc-c973dc474cd1b69ca06baf40f0590dc6dbfb4645.tar.gz
gcc/ChangeLog:
2009-01-21 Dodji Seketeli <dodji@redhat.com> 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 <dodji@redhat.com> 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 <dodji@redhat.com> 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 <dodji@redhat.com> * 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++. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@143546 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/name-lookup.c')
-rw-r--r--gcc/cp/name-lookup.c30
1 files changed, 11 insertions, 19 deletions
diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c
index f8d0204f099..2c69cfe68a6 100644
--- a/gcc/cp/name-lookup.c
+++ b/gcc/cp/name-lookup.c
@@ -847,28 +847,20 @@ pushdecl_maybe_friend (tree x, bool is_friend)
/* If declaring a type as a typedef, copy the type (unless we're
at line 0), and install this TYPE_DECL as the new type's typedef
- name. See the extensive comment in ../c-decl.c (pushdecl). */
+ name. See the extensive comment of set_underlying_type (). */
if (TREE_CODE (x) == TYPE_DECL)
{
tree type = TREE_TYPE (x);
- if (DECL_IS_BUILTIN (x))
- {
- if (TYPE_NAME (type) == 0)
- TYPE_NAME (type) = x;
- }
- else if (type != error_mark_node && TYPE_NAME (type) != x
- /* We don't want to copy the type when all we're
- doing is making a TYPE_DECL for the purposes of
- inlining. */
- && (!TYPE_NAME (type)
- || TYPE_NAME (type) != DECL_ABSTRACT_ORIGIN (x)))
- {
- DECL_ORIGINAL_TYPE (x) = type;
- type = build_variant_type_copy (type);
- TYPE_STUB_DECL (type) = TYPE_STUB_DECL (DECL_ORIGINAL_TYPE (x));
- TYPE_NAME (type) = x;
- TREE_TYPE (x) = type;
- }
+
+ if (DECL_IS_BUILTIN (x)
+ || (TREE_TYPE (x) != error_mark_node
+ && TYPE_NAME (type) != x
+ /* We don't want to copy the type when all we're
+ doing is making a TYPE_DECL for the purposes of
+ inlining. */
+ && (!TYPE_NAME (type)
+ || TYPE_NAME (type) != DECL_ABSTRACT_ORIGIN (x))))
+ set_underlying_type (x);
if (type != error_mark_node
&& TYPE_NAME (type)