backport: re PR c++/90950 (OpenMP clause handling rejecting references to incomplete types in templates)

Backported from mainline
	2019-06-21  Jakub Jelinek  <jakub@redhat.com>

	PR c++/90950
	* semantics.c (finish_omp_clauses): Don't reject references to
	incomplete types if processing_template_decl.

	* g++.dg/gomp/lastprivate-1.C: New test.

From-SVN: r275160
This commit is contained in:
Jakub Jelinek 2019-08-30 14:46:52 +02:00 committed by Jakub Jelinek
parent 2dbbeed4a7
commit 630bb153d6
4 changed files with 29 additions and 1 deletions

View File

@ -1,6 +1,12 @@
2019-08-30 Jakub Jelinek <jakub@redhat.com>
Backported from mainline
2019-06-21 Jakub Jelinek <jakub@redhat.com>
PR c++/90950
* semantics.c (finish_omp_clauses): Don't reject references to
incomplete types if processing_template_decl.
2019-05-10 Jakub Jelinek <jakub@redhat.com>
PR pch/90326

View File

@ -7369,7 +7369,8 @@ finish_omp_clauses (tree clauses, enum c_omp_region_type ort)
t = require_complete_type (t);
if (t == error_mark_node)
remove = true;
else if (TREE_CODE (TREE_TYPE (t)) == REFERENCE_TYPE
else if (!processing_template_decl
&& TREE_CODE (TREE_TYPE (t)) == REFERENCE_TYPE
&& !complete_type_or_else (TREE_TYPE (TREE_TYPE (t)), t))
remove = true;
}

View File

@ -1,6 +1,11 @@
2019-08-30 Jakub Jelinek <jakub@redhat.com>
Backported from mainline
2019-06-21 Jakub Jelinek <jakub@redhat.com>
PR c++/90950
* g++.dg/gomp/lastprivate-1.C: New test.
2019-06-12 Jakub Jelinek <jakub@redhat.com>
PR c/90760

View File

@ -0,0 +1,16 @@
// PR c++/90950
// { dg-do compile }
template <typename T>
T
foo (void)
{
T y = 0;
T &x = y;
#pragma omp parallel for lastprivate (x)
for (int i = 0; i < 8; ++i)
x = i;
return x;
}
int a = foo<int> ();