diff options
author | Jason Merrill <jason@redhat.com> | 2011-11-07 17:52:32 -0500 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2011-11-07 17:52:32 -0500 |
commit | 13fc31c2c49bbe4ca18bb1bf90007d03ba7ab13b (patch) | |
tree | 16bf29f4581d78c2866452a7e1a97269889f88cd /gcc | |
parent | b2b5f337dc066ab64e5a165779146494dfb8fde0 (diff) | |
download | gcc-13fc31c2c49bbe4ca18bb1bf90007d03ba7ab13b.zip gcc-13fc31c2c49bbe4ca18bb1bf90007d03ba7ab13b.tar.gz gcc-13fc31c2c49bbe4ca18bb1bf90007d03ba7ab13b.tar.bz2 |
re PR c++/50863 ([C++0x] list-initialization with lambda fails to deduce constructor argument)
PR c++/50863
* parser.c (cp_parser_initializer_list): Parse C99
array designators tentatively.
From-SVN: r181132
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/cp/parser.c | 3 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 3 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/lambda/lambda-initlist1.C | 12 |
4 files changed, 22 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 4945fd9..92025a9 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2011-11-07 Jason Merrill <jason@redhat.com> + PR c++/50863 + * parser.c (cp_parser_initializer_list): Parse C99 + array designators tentatively. + PR c++/50870 * pt.c (tsubst_copy): Handle NAMESPACE_DECL. (tsubst_copy_and_build) [COMPONENT_REF]: Handle a still-dependent diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index fa0117e..697be80 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -17580,10 +17580,13 @@ cp_parser_initializer_list (cp_parser* parser, bool* non_constant_p) && !c_dialect_objc () && cp_lexer_next_token_is (parser->lexer, CPP_OPEN_SQUARE)) { + /* In C++11, [ could start a lambda-introducer. */ + cp_parser_parse_tentatively (parser); cp_lexer_consume_token (parser->lexer); designator = cp_parser_constant_expression (parser, false, NULL); cp_parser_require (parser, CPP_CLOSE_SQUARE, RT_CLOSE_SQUARE); cp_parser_require (parser, CPP_EQ, RT_EQ); + cp_parser_parse_definitely (parser); } else designator = NULL_TREE; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e2eccc5..c5f4118 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2011-11-07 Jason Merrill <jason@redhat.com> + PR c++/50863 + * g++.dg/cpp0x/lambda/lambda-initlist1.C: New. + PR c++/50870 * g++.dg/cpp0x/decltype35.C: New. diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-initlist1.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-initlist1.C new file mode 100644 index 0000000..078ebae --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-initlist1.C @@ -0,0 +1,12 @@ +// PR c++/50863 +// { dg-options -std=gnu++0x } + +struct T { + template<typename F> + T(F) { } +}; + +int main() +{ + T t{ []{ } }; +} |