aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2008-03-10 20:48:20 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2008-03-10 20:48:20 +0100
commitfde155a75b947dea15d8e5fd877ec7bae59e1afb (patch)
treee45e063e5813be078464f67f5012c35accb59b7c
parent85b20612e78772cce5700f4e6e5afcef072d4703 (diff)
downloadgcc-fde155a75b947dea15d8e5fd877ec7bae59e1afb.zip
gcc-fde155a75b947dea15d8e5fd877ec7bae59e1afb.tar.gz
gcc-fde155a75b947dea15d8e5fd877ec7bae59e1afb.tar.bz2
re PR c++/35328 (ICE with firstprivate variable with invalid destructor)
PR c++/35328 * semantics.c (finish_omp_clauses): Look through NOP_EXPR even if errorcount. * g++.dg/gomp/pr35328.C: New test. From-SVN: r133087
-rw-r--r--gcc/cp/ChangeLog4
-rw-r--r--gcc/cp/semantics.c4
-rw-r--r--gcc/testsuite/ChangeLog3
-rw-r--r--gcc/testsuite/g++.dg/gomp/pr35328.C31
4 files changed, 40 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 4ae8f17..673bc6a 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,9 @@
2008-03-10 Jakub Jelinek <jakub@redhat.com>
+ PR c++/35328
+ * semantics.c (finish_omp_clauses): Look through NOP_EXPR even
+ if errorcount.
+
PR c++/35337
* semantics.c (finish_omp_clauses): Use %qD instead of %qE for
DECL_P in not a variable and appears more than once error messages.
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index 2ee67cb..d17a22e 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -3667,7 +3667,7 @@ finish_omp_clauses (tree clauses)
complete_ctor_identifier,
t, inner_type, LOOKUP_NORMAL);
- if (targetm.cxx.cdtor_returns_this ())
+ if (targetm.cxx.cdtor_returns_this () || errorcount)
/* Because constructors and destructors return this,
the call will have been cast to "void". Remove the
cast here. We would like to use STRIP_NOPS, but it
@@ -3689,7 +3689,7 @@ finish_omp_clauses (tree clauses)
t = build_special_member_call (t, complete_dtor_identifier,
NULL, inner_type, LOOKUP_NORMAL);
- if (targetm.cxx.cdtor_returns_this ())
+ if (targetm.cxx.cdtor_returns_this () || errorcount)
/* Because constructors and destructors return this,
the call will have been cast to "void". Remove the
cast here. We would like to use STRIP_NOPS, but it
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 22c6ee8..ad3523e 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,8 @@
2008-03-10 Jakub Jelinek <jakub@redhat.com>
+ PR c++/35328
+ * g++.dg/gomp/pr35328.C: New test.
+
PR c++/35337
* g++.dg/gomp/pr35337.C: New test.
diff --git a/gcc/testsuite/g++.dg/gomp/pr35328.C b/gcc/testsuite/g++.dg/gomp/pr35328.C
new file mode 100644
index 0000000..718283b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/gomp/pr35328.C
@@ -0,0 +1,31 @@
+// PR c++/35328
+// { dg-do compile }
+// { dg-options "-fopenmp" }
+
+struct A
+{
+ ~A ()(); // { dg-error "declared as function returning a function" }
+};
+struct B
+{
+ B ()(); // { dg-error "declared as function returning a function" }
+};
+struct C
+{
+ C ();
+ C (const C &)(); // { dg-error "declared as function returning a function" }
+};
+
+void
+foo ()
+{
+ A a;
+ B b;
+ C c;
+ #pragma omp parallel firstprivate (a)
+ ;
+ #pragma omp parallel private (b)
+ ;
+ #pragma omp parallel firstprivate (c)
+ ;
+}