public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "dodji at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/26693] [4.3/4.4/4.5 regression] Access checks not performed for types in templates
Date: Thu, 02 Apr 2009 09:24:00 -0000	[thread overview]
Message-ID: <20090402092439.22141.qmail@sourceware.org> (raw)
In-Reply-To: <bug-26693-1771@http.gcc.gnu.org/bugzilla/>



------- Comment #13 from dodji at gcc dot gnu dot org  2009-04-02 09:24 -------
Subject: Bug 26693

Author: dodji
Date: Thu Apr  2 09:24:19 2009
New Revision: 145440

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=145440
Log:
gcc/ChangeLog:
2009-04-02  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.
    * c-common.h (is_typedef_decl, set_underlying_type): Declare ...
    * c-common.c (is_typedef_decl, set_underlying_type): ... new entry points.

gcc/cp/ChangeLog:
2009-04-02  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.
    (xref_basetypes) : Fixup the variant types after setting
    TYPE_BINFO on REF.
    * 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 ...
    * class.c (finish_struct_bits): Split type variant fixup into ...
    (fixup_type_variants): A new entry point.
    * pt.c (instantiate_class_template, instantiate_template ): ... access
    checked at template instantiation time.
    (resolve_type_name_type): The type name should be the name of the
    main type variant.
    (retrieve_specialization): Specializations of template typedefs aren't
    to be looked up in DECL_TEMPLATE_INSTANTIATIONS (tmpl).
    (append_type_to_template_for_access_check): New entry point.
    (tsubst_decl): For typedefs, build the variant type from the correct
    original type.
    (get_class_bindings): Fix function comment.
    (perform_typedefs_access_check): New entry point.

gcc/testsuite/ChangeLog:
2009-04-02  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/typedef15.C: Likewise.
    * g++.dg/template/typedef16.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-04-02  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++.


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
    trunk/gcc/testsuite/g++.dg/template/typedef15.C
    trunk/gcc/testsuite/g++.dg/template/typedef16.C
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/c-common.c
    trunk/gcc/c-common.h
    trunk/gcc/c-decl.c
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/class.c
    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/libstdc++-v3/ChangeLog
    trunk/libstdc++-v3/include/ext/bitmap_allocator.h


-- 


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


  parent reply	other threads:[~2009-04-02  9:24 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-15 13:20 [Bug c++/26693] New: [4.0/4.1/4.2 " reichelt at gcc dot gnu dot org
2006-03-15 13:24 ` [Bug c++/26693] " pinskia at gcc dot gnu dot org
2006-06-04 18:06 ` mmitchel at gcc dot gnu dot org
2006-09-07  7:18 ` jason at gcc dot gnu dot org
2007-02-03 16:24 ` [Bug c++/26693] [4.0/4.1/4.2/4.3 " gdr at gcc dot gnu dot org
2007-02-03 17:27 ` jsm28 at gcc dot gnu dot org
2007-02-14  9:10 ` mmitchel at gcc dot gnu dot org
2008-07-04 20:22 ` [Bug c++/26693] [4.2/4.3/4.4 " jsm28 at gcc dot gnu dot org
2008-08-21 11:59 ` paolo dot carlini at oracle dot com
2008-10-28 12:17 ` dodji at gcc dot gnu dot org
2008-10-29 21:56 ` dodji at gcc dot gnu dot org
2008-11-01 14:31 ` dodji at gcc dot gnu dot org
2009-01-21 16:15 ` dodji at gcc dot gnu dot org
2009-01-22  7:16 ` dodji at gcc dot gnu dot org
2009-03-24 13:55 ` howarth at nitro dot med dot uc dot edu
2009-03-28 20:19 ` reichelt at gcc dot gnu dot org
2009-03-31 19:31 ` [Bug c++/26693] [4.3/4.4/4.5 " jsm28 at gcc dot gnu dot org
2009-04-02  9:24 ` dodji at gcc dot gnu dot org [this message]
2009-04-02  9:36 ` dodji at gcc dot gnu dot org
2009-04-02  9:39 ` dodji at gcc dot gnu dot org
2009-04-02  9:45 ` jakub at gcc dot gnu dot org
2009-04-29  7:09 ` pinskia at gcc dot gnu dot org
2009-05-05 13:07 ` jwakely dot gcc at gmail dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090402092439.22141.qmail@sourceware.org \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).