From: Jakub Jelinek Date: Thu, 19 May 2011 13:11:56 +0000 (+0200) Subject: re PR c++/49043 ([OpenMP & C++0x]: Compiler error when lambda-function within OpenMP... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ea93a47bc825a409079665551203aa194e71fc18;p=gcc.git re PR c++/49043 ([OpenMP & C++0x]: Compiler error when lambda-function within OpenMP loop) PR c++/49043 * decl.c (check_omp_return): Stop searching on sk_function_parms. * testsuite/libgomp.c++/pr49043.C: New test. From-SVN: r173907 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 1ab211918dc..7e59b6b067a 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,8 @@ 2011-05-19 Jakub Jelinek + PR c++/49043 + * decl.c (check_omp_return): Stop searching on sk_function_parms. + PR c++/48869 * method.c (get_dtor, get_copy_ctor): Add COMPLAIN argument, pass it down to locate_fn_flags. diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index e950c43e9cf..91df9ee671e 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -2833,6 +2833,8 @@ check_omp_return (void) error ("invalid exit from OpenMP structured block"); return false; } + else if (b->kind == sk_function_parms) + break; return true; } diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog index 97382893917..7d3fe227c5e 100644 --- a/libgomp/ChangeLog +++ b/libgomp/ChangeLog @@ -1,5 +1,8 @@ 2011-05-19 Jakub Jelinek + PR c++/49043 + * testsuite/libgomp.c++/pr49043.C: New test. + PR c++/48869 * testsuite/libgomp.c++/pr48869.C: New test. diff --git a/libgomp/testsuite/libgomp.c++/pr49043.C b/libgomp/testsuite/libgomp.c++/pr49043.C new file mode 100644 index 00000000000..604cfc30dad --- /dev/null +++ b/libgomp/testsuite/libgomp.c++/pr49043.C @@ -0,0 +1,19 @@ +// PR c++/49043 +// { dg-options "-std=c++0x" } +// { dg-do run } + +extern "C" void abort (); + +int +main () +{ + int r = 0; + #pragma omp parallel for reduction (+:r) + for (int a = 0; a < 10; ++a) + { + auto func = [=] () { return a; }; + r += func (); + } + if (r != 45) + abort (); +}