OK.

On Fri, Mar 23, 2018 at 12:04 AM, Alexandre Oliva <aol...@redhat.com> wrote:
> On Mar 22, 2018, Jason Merrill <ja...@redhat.com> wrote:
>
>> I think we definitely want to move the check down below the
>> cp_parser_commit_to_tentative_parse.
>
> This worked.  Regstrapped on i686- and x86_64-linux-gnu.  Ok to install?
>
> [PR c++/71251] check tmpl parms in template using decl
>
> Check that template using decls have the correct number of parm lists.
>
> for  gcc/cp/ChangeLog
>
>         PR c++/71251
>         * parser.c (cp_parser_alias_declaration): Call
>         parser_check_template_parameters.
>
> for  gcc/testsuite/ChangeLog
>
>         PR c++/71251
>         * g++.dg/cpp0x/pr71251.C: New.
> ---
>  gcc/cp/parser.c                      |    7 +++++++
>  gcc/testsuite/g++.dg/cpp0x/pr71251.C |   15 +++++++++++++++
>  2 files changed, 22 insertions(+)
>  create mode 100644 gcc/testsuite/g++.dg/cpp0x/pr71251.C
>
> diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
> index fd817024eacf..602cc991ff6e 100644
> --- a/gcc/cp/parser.c
> +++ b/gcc/cp/parser.c
> @@ -18965,6 +18965,13 @@ cp_parser_alias_declaration (cp_parser* parser)
>                                ds_alias,
>                                using_token);
>
> +  if (parser->num_template_parameter_lists
> +      && !cp_parser_check_template_parameters (parser,
> +                                              /*num_templates=*/0,
> +                                              id_location,
> +                                              /*declarator=*/NULL))
> +    return error_mark_node;
> +
>    declarator = make_id_declarator (NULL_TREE, id, sfk_none);
>    declarator->id_loc = id_location;
>
> diff --git a/gcc/testsuite/g++.dg/cpp0x/pr71251.C 
> b/gcc/testsuite/g++.dg/cpp0x/pr71251.C
> new file mode 100644
> index 000000000000..3df831bb581d
> --- /dev/null
> +++ b/gcc/testsuite/g++.dg/cpp0x/pr71251.C
> @@ -0,0 +1,15 @@
> +// { dg-do compile { target c++11 } }
> +
> +template<int,int> template<typename>
> +using U = void; // { dg-error "too many" }
> +
> +template<typename>
> +using V = void;
> +
> +template<typename> struct X {
> +  template<typename> template<typename>
> +  using U = void; // { dg-error "too many" }
> +
> +  template<typename>
> +  using V = void;
> +};
>
>
> --
> Alexandre Oliva, freedom fighter    http://FSFLA.org/~lxoliva/
> You must be the change you wish to see in the world. -- Gandhi
> Be Free! -- http://FSFLA.org/   FSF Latin America board member
> Free Software Evangelist|Red Hat Brasil GNU Toolchain Engineer

Reply via email to