public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [C++ Patch] PR 61683
@ 2015-04-30  0:56 Paolo Carlini
  2015-05-11 15:57 ` [Ping] " Paolo Carlini
  2015-05-22  7:54 ` Paolo Carlini
  0 siblings, 2 replies; 4+ messages in thread
From: Paolo Carlini @ 2015-04-30  0:56 UTC (permalink / raw)
  To: gcc-patches; +Cc: Jason Merrill

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

Hi,

this seems pretty straightforward given the grammar. Tested x86_64-linux.

Thanks,
Paolo.

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

[-- Attachment #2: CL_61683 --]
[-- Type: text/plain, Size: 264 bytes --]

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

	PR c++/61683
	* parser.c (cp_parser_mem_initializer): Allow for decltype-specifier.

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

	PR c++/61683
	* g++.dg/cpp0x/decltype-base1.C: New.

[-- Attachment #3: patch_61683 --]
[-- Type: text/plain, Size: 1823 bytes --]

Index: cp/parser.c
===================================================================
--- cp/parser.c	(revision 222599)
+++ cp/parser.c	(working copy)
@@ -12776,6 +12776,7 @@ cp_parser_mem_initializer (cp_parser* parser)
 
    mem-initializer-id:
      :: [opt] nested-name-specifier [opt] class-name
+     decltype-specifier (C++11)
      identifier
 
    Returns a TYPE indicating the class to be initializer for the first
@@ -12838,14 +12839,18 @@ cp_parser_mem_initializer_id (cp_parser* parser)
 				 /*is_declaration=*/true);
   /* Otherwise, we could also be looking for an ordinary identifier.  */
   cp_parser_parse_tentatively (parser);
-  /* Try a class-name.  */
-  id = cp_parser_class_name (parser,
-			     /*typename_keyword_p=*/true,
-			     /*template_keyword_p=*/false,
-			     none_type,
-			     /*check_dependency_p=*/true,
-			     /*class_head_p=*/false,
-			     /*is_declaration=*/true);
+  if (cp_lexer_next_token_is_decltype (parser->lexer))
+    /* Try a decltype-specifier.  */
+    id = cp_parser_decltype (parser);
+  else
+    /* Otherwise, try a class-name.  */
+    id = cp_parser_class_name (parser,
+			       /*typename_keyword_p=*/true,
+			       /*template_keyword_p=*/false,
+			       none_type,
+			       /*check_dependency_p=*/true,
+			       /*class_head_p=*/false,
+			       /*is_declaration=*/true);
   /* If we found one, we're done.  */
   if (cp_parser_parse_definitely (parser))
     return id;
Index: testsuite/g++.dg/cpp0x/decltype-base1.C
===================================================================
--- testsuite/g++.dg/cpp0x/decltype-base1.C	(revision 0)
+++ testsuite/g++.dg/cpp0x/decltype-base1.C	(working copy)
@@ -0,0 +1,8 @@
+// PR c++/61683
+// { dg-do compile { target c++11 } }
+
+struct A {};
+A a;
+struct B : A {
+  B(): decltype(a)() {}
+};

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Ping] [C++ Patch] PR 61683
  2015-04-30  0:56 [C++ Patch] PR 61683 Paolo Carlini
@ 2015-05-11 15:57 ` Paolo Carlini
  2015-05-22  7:54 ` Paolo Carlini
  1 sibling, 0 replies; 4+ messages in thread
From: Paolo Carlini @ 2015-05-11 15:57 UTC (permalink / raw)
  To: gcc-patches; +Cc: Jason Merrill

Hi,

pinging this...

On 04/30/2015 01:56 AM, Paolo Carlini wrote:
> Hi,
>
> this seems pretty straightforward given the grammar. Tested x86_64-linux.

     https://gcc.gnu.org/ml/gcc-patches/2015-04/msg01948.html

Paolo.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [C++ Patch] PR 61683
  2015-04-30  0:56 [C++ Patch] PR 61683 Paolo Carlini
  2015-05-11 15:57 ` [Ping] " Paolo Carlini
@ 2015-05-22  7:54 ` Paolo Carlini
  2015-05-25 19:56   ` Jason Merrill
  1 sibling, 1 reply; 4+ messages in thread
From: Paolo Carlini @ 2015-05-22  7:54 UTC (permalink / raw)
  To: gcc-patches; +Cc: Jason Merrill

Hi,

On 04/30/2015 01:56 AM, Paolo Carlini wrote:
> Hi,
>
> this seems pretty straightforward given the grammar. Tested x86_64-linux.
... again, given the grammar, I think this is even obvious: if nobody 
screams, I'm going to commit the patch in a day or so (but I'm naming 
the testcase decltype-mem-initializer1.C instead, seems more correct to me)

Thanks!
Paolo.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [C++ Patch] PR 61683
  2015-05-22  7:54 ` Paolo Carlini
@ 2015-05-25 19:56   ` Jason Merrill
  0 siblings, 0 replies; 4+ messages in thread
From: Jason Merrill @ 2015-05-25 19:56 UTC (permalink / raw)
  To: Paolo Carlini, gcc-patches

OK, thanks.

Jason

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-05-25 19:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-30  0:56 [C++ Patch] PR 61683 Paolo Carlini
2015-05-11 15:57 ` [Ping] " Paolo Carlini
2015-05-22  7:54 ` Paolo Carlini
2015-05-25 19:56   ` Jason Merrill

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).