aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorPaolo Carlini <paolo.carlini@oracle.com>2015-06-02 10:28:14 +0000
committerPaolo Carlini <paolo@gcc.gnu.org>2015-06-02 10:28:14 +0000
commita983abd29c19a3bbfa39512d1622e92797f22521 (patch)
tree32089317911fe9b254dfcde2e5f988dd15e605cd /gcc
parentb4147b63ad2d8dace41f33d62ac341b7c64ae905 (diff)
downloadgcc-a983abd29c19a3bbfa39512d1622e92797f22521.zip
gcc-a983abd29c19a3bbfa39512d1622e92797f22521.tar.gz
gcc-a983abd29c19a3bbfa39512d1622e92797f22521.tar.bz2
re PR c++/61683 (decltype-specifier not accepted as mem-initializer-id)
/cp 2015-06-02 Paolo Carlini <paolo.carlini@oracle.com> PR c++/61683 * parser.c (cp_parser_mem_initializer): Allow for decltype-specifier. /testsuite 2015-06-02 Paolo Carlini <paolo.carlini@oracle.com> PR c++/61683 * g++.dg/cpp0x/decltype-mem-initializer1.C: New. From-SVN: r224022
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/parser.c27
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/decltype-mem-initializer1.C8
4 files changed, 34 insertions, 11 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index be1a3f9..c6f1a6d 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,8 @@
+2015-06-02 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/61683
+ * parser.c (cp_parser_mem_initializer): Allow for decltype-specifier.
+
2015-06-01 Jason Merrill <jason@redhat.com>
PR c++/65942
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index bc48c11..9ae555c 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -12803,11 +12803,12 @@ 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
- production. Returns an IDENTIFIER_NODE indicating the data member
- to be initialized for the second production. */
+ Returns a TYPE indicating the class to be initialized for the first
+ production (and the second in C++11). Returns an IDENTIFIER_NODE
+ indicating the data member to be initialized for the last production. */
static tree
cp_parser_mem_initializer_id (cp_parser* parser)
@@ -12865,14 +12866,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;
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 39617815..2ea81dd 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2015-06-02 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/61683
+ * g++.dg/cpp0x/decltype-mem-initializer1.C: New.
+
2015-06-02 Bin Cheng <bin.cheng@arm.com>
PR tree-optimization/48052
diff --git a/gcc/testsuite/g++.dg/cpp0x/decltype-mem-initializer1.C b/gcc/testsuite/g++.dg/cpp0x/decltype-mem-initializer1.C
new file mode 100644
index 0000000..d036b29
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/decltype-mem-initializer1.C
@@ -0,0 +1,8 @@
+// PR c++/61683
+// { dg-do compile { target c++11 } }
+
+struct A {};
+A a;
+struct B : A {
+ B(): decltype(a)() {}
+};