diff options
author | Jason Merrill <jason@redhat.com> | 2011-08-30 17:27:18 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2011-08-30 17:27:18 -0400 |
commit | 971df06b2f4cd9335b34d087f82ec7a471b5871d (patch) | |
tree | d9de46214c4c4d3cb72fb6187739caaf7c63aaea /gcc | |
parent | c683a53ae1ce9f41e96074a1695d5f3c8a03d8d8 (diff) | |
download | gcc-971df06b2f4cd9335b34d087f82ec7a471b5871d.zip gcc-971df06b2f4cd9335b34d087f82ec7a471b5871d.tar.gz gcc-971df06b2f4cd9335b34d087f82ec7a471b5871d.tar.bz2 |
re PR c++/50114 (ICE with declaration inside for statement)
PR c++/50114
* decl.c (poplevel): Disable for scope compatibility hack
in C++11 mode.
From-SVN: r178338
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/cp/decl.c | 3 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/lambda/lambda-for.C | 12 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/ext/forscope2.C | 2 |
5 files changed, 25 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index c2c00a7..799fc2a 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2011-08-30 Jason Merrill <jason@redhat.com> + PR c++/50114 + * decl.c (poplevel): Disable for scope compatibility hack + in C++11 mode. + PR c++/50220 * semantics.c (add_capture): Call complete_type for copy. diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index c375cf7..9090b11 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -643,6 +643,9 @@ poplevel (int keep, int reverse, int functionbody) for (link = decls; link; link = TREE_CHAIN (link)) { if (leaving_for_scope && TREE_CODE (link) == VAR_DECL + /* It's hard to make this ARM compatibility hack play nicely with + lambdas, and it really isn't necessary in C++11 mode. */ + && cxx_dialect < cxx0x && DECL_NAME (link)) { tree name = DECL_NAME (link); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index a8fbdd6..9cc012f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2011-08-30 Jason Merrill <jason@redhat.com> + + PR c++/50114 + * g++.dg/cpp0x/lambda/lambda-for.C: New. + 2011-08-30 Uros Bizjak <ubizjak@gmail.com> * gcc.target/i386/fma-compile.c: Escape [ and ] in scan strings. diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-for.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-for.C new file mode 100644 index 0000000..f161da8 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-for.C @@ -0,0 +1,12 @@ +// PR c++/50114 +// { dg-options "-std=c++0x -w" } + +int open() +{ + int *x2feed_i = 0; + auto insert_feed = [&](unsigned char venue, int* newfeed) + { + for(int x2feed_i = 1; 0; ) ; + x2feed_i = newfeed; + }; +} diff --git a/gcc/testsuite/g++.dg/ext/forscope2.C b/gcc/testsuite/g++.dg/ext/forscope2.C index b883eff..4c63bab 100644 --- a/gcc/testsuite/g++.dg/ext/forscope2.C +++ b/gcc/testsuite/g++.dg/ext/forscope2.C @@ -1,5 +1,5 @@ // { dg-do compile } -// { dg-options -fpermissive } +// { dg-options "-fpermissive -std=c++98" } // Copyright (C) 2001 Free Software Foundation, Inc. // Contributed by Nathan Sidwell 4 Sept 2001 <nathan@codesourcery.com> |