public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "dodji at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/45114] implement C++0x alias-declaration
Date: Mon, 07 Nov 2011 21:47:00 -0000	[thread overview]
Message-ID: <bug-45114-4-X0PMZc1OXz@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-45114-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #13 from Dodji Seketeli <dodji at gcc dot gnu.org> 2011-11-07 21:28:55 UTC ---
Author: dodji
Date: Mon Nov  7 21:28:50 2011
New Revision: 181118

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=181118
Log:
PR c++/45114 - Support C++11 alias-declaration

gcc/cp/

    * cp-tree.h (TYPE_DECL_ALIAS_P, TYPE_ALIAS_P)
    (DECL_TYPE_TEMPLATE_P, DECL_ALIAS_TEMPLATE_P): New accessor
    macros.
    (TYPE_TEMPLATE_INFO): Get template info of an alias template
    specializations from its TYPE_DECL.
    (SET_TYPE_TEMPLATE_INFO): Set template info of alias template
    specializations into its TYPE_DECL.
    (DECL_CLASS_TEMPLATE_P): Re-write using the new
    DECL_TYPE_TEMPLATE_P.
    (enum cp_decl_spec): Add new ds_alias enumerator.
    (alias_type_or_template_p, alias_template_specialization_p):
    Declare new functions.
    * parser.c (cp_parser_alias_declaration): New static function.
    (cp_parser_check_decl_spec): Add "using" name for the `alias'
    declspec.
    (cp_parser_type_name): Update comment.  Support simple-template-id
    representing alias template specializations in c++0x mode.
    (cp_parser_qualifying_entity): Update comment.  Use
    cp_parser_type_name.
    (cp_parser_block_declaration): Handle alias-declaration in c++11.
    Update comment.
    (cp_parser_template_id): Handle specializations of alias
    templates.
    (cp_parser_member_declaration): Add alias-declaration production
    to comment.  Support alias-declarations.
    (cp_parser_template_declaration_after_export): Handle alias
    templates in c++11.
    * decl.c (make_typename_type, make_unbound_class_template): Accept
    alias templates.
    (grokdeclarator): Set TYPE_DECL_ALIAS_P on alias
    declarations.
    * decl2.c (grokfield): Move template creation after setting up the
    TYPE_DECL of the alias, so that the TEMPLATE_DECL of the alias
    template actually carries the right type-id of the alias
    declaration.
    * pt.c (alias_type_or_template_p)
    (alias_template_specialization_p): Define new public functions.
    (maybe_process_partial_specialization): Reject partial
    specializations of alias templates.
    (primary_template_instantiation_p): Consider alias template
    instantiations.
    (push_template_decl_real): Assert that TYPE_DECLs of alias
    templates are different from those of class template.  Store
    template info onto the TYPE_DECL of the alias template.
    (convert_template_argument): Strip aliases from template
    arguments.
    (lookup_template_class_1): Handle the creation of the
    specialization of an alias template.
    (tsubst_decl): Create a substituted copy of the TYPE_DECL of an
    member alias template.
    (tsubst): Handle substituting into the type of an alias template.
    Handle substituting UNBOUND_CLASS_TEMPLATE into
    BOUND_TEMPLATE_TEMPLATE_PARM.
    (do_type_instantiation): Better diagnostics when trying to
    explicitely instantiate a non-class template.
    * search.c (lookup_field_1, lookup_field_r): Support looking up
    alias templates.
    * semantics.c (finish_template_type): For instantiations of alias
    templates, return the TYPE_DECL of the actual alias and not the
    one of the aliased type.
    * error.c (dump_alias_template_specialization): New static
    function.
    (dump_type): Handle printing of alias templates and their
    specializations.  templates.
    (dump_aggr_type): For specialization of alias templates, fetch
    arguments from the right place.
    (dump_decl): Print an alias-declaration like `using decl = type;'
    (dump_template_decl):  Support printing of alias templates.

gcc/testsuite/

    * g++.dg/cpp0x/alias-decl-0.C: New test case.
    * g++.dg/cpp0x/alias-decl-1.C: Likewise.
    * g++.dg/cpp0x/alias-decl-3.C: Likewise.
    * g++.dg/cpp0x/alias-decl-4.C: Likewise.
    * g++.dg/cpp0x/alias-decl-6.C: Likewise.
    * g++.dg/cpp0x/alias-decl-7.C: Likewise.
    * g++.dg/cpp0x/alias-decl-8.C: Likewise.
    * g++.dg/cpp0x/alias-decl-9.C: Likewise.
    * g++.dg/cpp0x/alias-decl-10.C: Likewise.
    * g++.dg/ext/alias-decl-attr1.C: Likewise.
    * g++.dg/ext/alias-decl-attr2.C: Likewise.
    * g++.dg/ext/alias-decl-attr3.C: Likewise.
    * g++.dg/ext/alias-decl-attr4.C: Likewise.

Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/alias-decl-0.C
    trunk/gcc/testsuite/g++.dg/cpp0x/alias-decl-1.C
    trunk/gcc/testsuite/g++.dg/cpp0x/alias-decl-10.C
    trunk/gcc/testsuite/g++.dg/cpp0x/alias-decl-2.C
    trunk/gcc/testsuite/g++.dg/cpp0x/alias-decl-3.C
    trunk/gcc/testsuite/g++.dg/cpp0x/alias-decl-4.C
    trunk/gcc/testsuite/g++.dg/cpp0x/alias-decl-5.C
    trunk/gcc/testsuite/g++.dg/cpp0x/alias-decl-6.C
    trunk/gcc/testsuite/g++.dg/cpp0x/alias-decl-7.C
    trunk/gcc/testsuite/g++.dg/cpp0x/alias-decl-8.C
    trunk/gcc/testsuite/g++.dg/cpp0x/alias-decl-9.C
    trunk/gcc/testsuite/g++.dg/ext/alias-decl-attr1.C
    trunk/gcc/testsuite/g++.dg/ext/alias-decl-attr2.C
    trunk/gcc/testsuite/g++.dg/ext/alias-decl-attr3.C
    trunk/gcc/testsuite/g++.dg/ext/alias-decl-attr4.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/cp-tree.h
    trunk/gcc/cp/decl.c
    trunk/gcc/cp/decl2.c
    trunk/gcc/cp/error.c
    trunk/gcc/cp/parser.c
    trunk/gcc/cp/pt.c
    trunk/gcc/cp/search.c
    trunk/gcc/cp/semantics.c
    trunk/gcc/testsuite/ChangeLog


  parent reply	other threads:[~2011-11-07 21:33 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-45114-4@http.gcc.gnu.org/bugzilla/>
2010-11-28 15:07 ` paolo.carlini at oracle dot com
2011-04-06 16:17 ` yacwroy at gmail dot com
2011-04-08 15:31 ` jason at gcc dot gnu.org
2011-08-16 10:30 ` redi at gcc dot gnu.org
2011-09-20 22:19 ` dodji at gcc dot gnu.org
2011-10-27 19:19 ` dodji at gcc dot gnu.org
2011-10-27 22:32 ` redi at gcc dot gnu.org
2011-10-31 16:09 ` vincenzo.innocente at cern dot ch
2011-10-31 16:18 ` vincenzo.innocente at cern dot ch
2011-11-05 23:49 ` dodji at seketeli dot org
2011-11-07 21:47 ` dodji at gcc dot gnu.org [this message]
2011-11-07 22:01 ` dodji at gcc dot gnu.org
2011-11-07 22:05 ` jacob.benoit.1 at gmail dot com
2011-11-07 22:48 ` redi at gcc dot gnu.org
2011-11-09 12:10 ` dodji at seketeli dot org
2011-11-09 12:19 ` dodji at seketeli dot org
2011-11-09 12:24 ` redi at gcc dot gnu.org
2022-11-30 21:03 ` pinskia at gcc dot gnu.org
2010-07-28 19:12 [Bug c++/45114] New: " jason at gcc dot gnu dot org
2010-07-28 19:12 ` [Bug c++/45114] " jason at gcc dot gnu dot org
2010-07-28 19:13 ` jason at gcc dot gnu dot org
2010-09-07 18:09 ` bangerth 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=bug-45114-4-X0PMZc1OXz@http.gcc.gnu.org/bugzilla/ \
    --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).