public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Paolo Carlini <paolo.carlini@oracle.com>
To: "gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>
Cc: Jason Merrill <jason@redhat.com>
Subject: [C++ Patch] PR 67318 ("[6 regression] Parsing error when using abbreviated integral type names in template parameter pack declaration")
Date: Wed, 09 Sep 2015 16:58:00 -0000	[thread overview]
Message-ID: <55F060D3.4070208@oracle.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 922 bytes --]

Hi,

I tracked down this regression to r225621, a clean up committed by Jason 
a while ago: unless we want to try something more aggressive, we can fix 
it the regression by simply restoring a few lines in 
cp_parser_template_parameter which consume the ellipsis. To clarify 
implementation-wise, the types affected are essentially all those for 
which cp_parser_simple_type_specifier (thus 
cp_parser_parameter_declaration) doesn't set the type in decl_specs:

       if (decl_specs
       && (token->keyword != RID_SIGNED
           && token->keyword != RID_UNSIGNED
           && token->keyword != RID_SHORT
           && token->keyword != RID_LONG))
     cp_parser_set_decl_spec_type (decl_specs,
                       type,
                       token,
                       /*type_definition_p=*/false);

Weird that we didn't have any testcase!

Tested x86_64-linux.

Thanks,
Paolo.

/////////////////////////




[-- Attachment #2: CL_67318 --]
[-- Type: text/plain, Size: 323 bytes --]

/cp
2015-09-09  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/67318
	* parser.c (cp_parser_template_parameter): Revert a few lines of
	r225621: consume the ellipsis and set *is_parameter_pack to true.

/testsuite
2015-09-09  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/67318
	* g++.dg/cpp0x/variadic166.C: New.

[-- Attachment #3: patch_67318 --]
[-- Type: text/plain, Size: 1425 bytes --]

Index: cp/parser.c
===================================================================
--- cp/parser.c	(revision 227586)
+++ cp/parser.c	(working copy)
@@ -13811,6 +13811,20 @@ cp_parser_template_parameter (cp_parser* parser, b
 	/* Consume the `...' for better error recovery.  */
 	cp_lexer_consume_token (parser->lexer);
     }
+  /* If the next token is an ellipsis, and we don't already have it
+     marked as a parameter pack, then we have a parameter pack (that
+     has no declarator).  */
+  else if (!*is_parameter_pack
+	   && cp_lexer_next_token_is (parser->lexer, CPP_ELLIPSIS)
+	   && (declarator_can_be_parameter_pack
+	       (parameter_declarator->declarator)))
+    {
+      /* Consume the `...'.  */
+      cp_lexer_consume_token (parser->lexer);
+      maybe_warn_variadic_templates ();
+      
+      *is_parameter_pack = true;
+    }
 
   // The parameter may have been constrained.
   if (is_constrained_parameter (parameter_declarator))
Index: testsuite/g++.dg/cpp0x/variadic166.C
===================================================================
--- testsuite/g++.dg/cpp0x/variadic166.C	(revision 0)
+++ testsuite/g++.dg/cpp0x/variadic166.C	(working copy)
@@ -0,0 +1,14 @@
+// PR c++/67318
+// { dg-do compile { target c++11 } }
+
+template<signed...>
+struct MyStruct1;
+
+template<unsigned...>
+struct MyStruct2;
+
+template<short...>
+struct MyStruct3;
+
+template<long...>
+struct MyStruct4;

             reply	other threads:[~2015-09-09 16:39 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-09 16:58 Paolo Carlini [this message]
2015-09-09 18:51 ` Jason Merrill
2015-09-09 19:35   ` Paolo Carlini
2015-09-09 21:14     ` Paolo Carlini
2015-09-10 13:36       ` Jason Merrill

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=55F060D3.4070208@oracle.com \
    --to=paolo.carlini@oracle.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jason@redhat.com \
    /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).