aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2020-04-07 11:38:28 -0700
committerIan Lance Taylor <iant@golang.org>2020-04-07 11:38:28 -0700
commitcaf99f28b0311c3ffb368819218e7ce4d245627e (patch)
tree7e200c42bded18d4077ae846817e390ae31735e4 /gcc/cp
parent42fd3e04ccbfbc47c1fddb15d384814637df0636 (diff)
parent50c7853216e8511971c55b51d7fe29173db4749b (diff)
downloadgcc-caf99f28b0311c3ffb368819218e7ce4d245627e.zip
gcc-caf99f28b0311c3ffb368819218e7ce4d245627e.tar.gz
gcc-caf99f28b0311c3ffb368819218e7ce4d245627e.tar.bz2
Merge from trunk revision 50c7853216e8511971c55b51d7fe29173db4749b
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog25
-rw-r--r--gcc/cp/coroutines.cc4
-rw-r--r--gcc/cp/decl.c5
-rw-r--r--gcc/cp/parser.c2
-rw-r--r--gcc/cp/tree.c2
-rw-r--r--gcc/cp/typeck2.c18
6 files changed, 51 insertions, 5 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index fc75879..60d9279 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,28 @@
+2020-04-07 Iain Sandoe <iain@sandoe.co.uk>
+
+ * coroutines.cc (maybe_promote_captured_temps): Ensure that
+ reference capture placeholder vars are properly declared.
+
+2020-04-07 Patrick Palka <ppalka@redhat.com>
+
+ PR c++/90996
+ * tree.c (replace_placeholders): Look through all handled components,
+ not just COMPONENT_REFs.
+ * typeck2.c (process_init_constructor_array): Propagate
+ CONSTRUCTOR_PLACEHOLDER_BOUNDARY up from each element initializer to
+ the array initializer.
+
+2020-04-07 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/94512
+ * parser.c (cp_parser_omp_parallel): Set OMP_PARALLEL_COMBINED
+ if cp_parser_omp_master succeeded.
+
+2020-04-06 Jason Merrill <jason@redhat.com>
+
+ PR c++/94462
+ * decl.c (duplicate_decls): Fix handling of DECL_HIDDEN_FRIEND_P.
+
2020-04-04 Marek Polacek <polacek@redhat.com>
Jason Merrill <jason@redhat.com>
diff --git a/gcc/cp/coroutines.cc b/gcc/cp/coroutines.cc
index 38a23a9..983fa65 100644
--- a/gcc/cp/coroutines.cc
+++ b/gcc/cp/coroutines.cc
@@ -2832,7 +2832,9 @@ maybe_promote_captured_temps (tree *stmt, void *d)
sloc = DECL_SOURCE_LOCATION (orig_temp);
DECL_SOURCE_LOCATION (newvar) = sloc;
DECL_CHAIN (newvar) = varlist;
- varlist = newvar;
+ varlist = newvar; /* Chain it onto the list for the bind expr. */
+ /* Declare and initialze it in the new bind scope. */
+ add_decl_expr (newvar);
tree stmt
= build2_loc (sloc, INIT_EXPR, var_type, newvar, to_replace);
stmt = coro_build_cvt_void_expr_stmt (stmt, sloc);
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 69a2389..a127734 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -1451,9 +1451,10 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend)
/* Check for redeclaration and other discrepancies. */
if (TREE_CODE (olddecl) == FUNCTION_DECL
- && DECL_ARTIFICIAL (olddecl))
+ && DECL_ARTIFICIAL (olddecl)
+ /* A C++20 implicit friend operator== uses the normal path (94462). */
+ && !DECL_HIDDEN_FRIEND_P (olddecl))
{
- gcc_assert (!DECL_HIDDEN_FRIEND_P (olddecl));
if (TREE_CODE (newdecl) != FUNCTION_DECL)
{
/* Avoid warnings redeclaring built-ins which have not been
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 7e5921e..fbcdc9b 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -39818,9 +39818,9 @@ cp_parser_omp_parallel (cp_parser *parser, cp_token *pragma_tok,
cp_parser_end_omp_structured_block (parser, save);
stmt = finish_omp_parallel (cclauses[C_OMP_CLAUSE_SPLIT_PARALLEL],
block);
- OMP_PARALLEL_COMBINED (stmt) = 1;
if (ret == NULL_TREE)
return ret;
+ OMP_PARALLEL_COMBINED (stmt) = 1;
return stmt;
}
else if (strcmp (p, "loop") == 0)
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index 5eb0dcd..d1192b7 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -3247,7 +3247,7 @@ replace_placeholders (tree exp, tree obj, bool *seen_p /*= NULL*/)
/* If the object isn't a (member of a) class, do nothing. */
tree op0 = obj;
- while (TREE_CODE (op0) == COMPONENT_REF)
+ while (handled_component_p (op0))
op0 = TREE_OPERAND (op0, 0);
if (!CLASS_TYPE_P (strip_array_types (TREE_TYPE (op0))))
return exp;
diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c
index cf1cb5a..56fd9ba 100644
--- a/gcc/cp/typeck2.c
+++ b/gcc/cp/typeck2.c
@@ -1488,6 +1488,17 @@ process_init_constructor_array (tree type, tree init, int nested, int flags,
= massage_init_elt (TREE_TYPE (type), ce->value, nested, flags,
complain);
+ if (TREE_CODE (ce->value) == CONSTRUCTOR
+ && CONSTRUCTOR_PLACEHOLDER_BOUNDARY (ce->value))
+ {
+ /* Shift CONSTRUCTOR_PLACEHOLDER_BOUNDARY from the element initializer
+ up to the array initializer, so that the call to
+ replace_placeholders from store_init_value can resolve any
+ PLACEHOLDER_EXPRs inside this element initializer. */
+ CONSTRUCTOR_PLACEHOLDER_BOUNDARY (ce->value) = 0;
+ CONSTRUCTOR_PLACEHOLDER_BOUNDARY (init) = 1;
+ }
+
gcc_checking_assert
(ce->value == error_mark_node
|| (same_type_ignoring_top_level_qualifiers_p
@@ -1516,6 +1527,13 @@ process_init_constructor_array (tree type, tree init, int nested, int flags,
/* The default zero-initialization is fine for us; don't
add anything to the CONSTRUCTOR. */
next = NULL_TREE;
+ else if (TREE_CODE (next) == CONSTRUCTOR
+ && CONSTRUCTOR_PLACEHOLDER_BOUNDARY (next))
+ {
+ /* As above. */
+ CONSTRUCTOR_PLACEHOLDER_BOUNDARY (next) = 0;
+ CONSTRUCTOR_PLACEHOLDER_BOUNDARY (init) = 1;
+ }
}
else if (!zero_init_p (TREE_TYPE (type)))
next = build_zero_init (TREE_TYPE (type),