summaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog16
-rw-r--r--gcc/cp/decl2.c5
-rw-r--r--gcc/cp/pt.c15
-rw-r--r--gcc/cp/semantics.c12
4 files changed, 35 insertions, 13 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 73ab5a9b0ae..9e8d933e745 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,19 @@
+2012-10-23 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/54922
+ * semantics.c (cx_check_missing_mem_inits): Handle anonymous union
+ members.
+
+2012-10-23 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/54844
+ * pt.c (tsubst_copy, tsubst_copy_and_build) <case SIZEOF_EXPR>: Use
+ tsubst instead of tsubst_copy* on types.
+
+ PR c++/54988
+ * decl2.c (cplus_decl_attributes): Don't return early
+ if attributes is NULL.
+
2012-10-18 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/54501
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index 688a72332ce..8657712916a 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -1309,8 +1309,7 @@ void
cplus_decl_attributes (tree *decl, tree attributes, int flags)
{
if (*decl == NULL_TREE || *decl == void_type_node
- || *decl == error_mark_node
- || attributes == NULL_TREE)
+ || *decl == error_mark_node)
return;
if (processing_template_decl)
@@ -1319,8 +1318,6 @@ cplus_decl_attributes (tree *decl, tree attributes, int flags)
return;
save_template_attributes (&attributes, decl);
- if (attributes == NULL_TREE)
- return;
}
cp_check_const_attributes (attributes);
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 7e8d8b0880d..1ff1c73b90d 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -12104,8 +12104,8 @@ tsubst_copy (tree t, tree args, tsubst_flags_t complain, tree in_decl)
}
if (SIZEOF_EXPR_TYPE_P (t))
{
- r = tsubst_copy (TREE_TYPE (TREE_OPERAND (t, 0)),
- args, complain, in_decl);
+ r = tsubst (TREE_TYPE (TREE_OPERAND (t, 0)),
+ args, complain, in_decl);
r = build1 (NOP_EXPR, r, error_mark_node);
r = build1 (SIZEOF_EXPR,
tsubst (TREE_TYPE (t), args, complain, in_decl), r);
@@ -13533,10 +13533,13 @@ tsubst_copy_and_build (tree t,
{
++cp_unevaluated_operand;
++c_inhibit_evaluation_warnings;
- op1 = tsubst_copy_and_build (op1, args, complain, in_decl,
- /*function_p=*/false,
- /*integral_constant_expression_p=*/
- false);
+ if (TYPE_P (op1))
+ op1 = tsubst (op1, args, complain, in_decl);
+ else
+ op1 = tsubst_copy_and_build (op1, args, complain, in_decl,
+ /*function_p=*/false,
+ /*integral_constant_expression_p=*/
+ false);
--cp_unevaluated_operand;
--c_inhibit_evaluation_warnings;
}
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index 6798c1bf5d4..63b364c37de 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -6139,17 +6139,23 @@ cx_check_missing_mem_inits (tree fun, tree body, bool complain)
for (i = 0; i <= nelts; ++i)
{
tree index;
+ tree anon_union_init_type = NULL_TREE;
if (i == nelts)
index = NULL_TREE;
else
{
index = CONSTRUCTOR_ELT (body, i)->index;
+ /* Handle anonymous union members. */
+ if (TREE_CODE (index) == COMPONENT_REF
+ && ANON_UNION_TYPE_P (TREE_TYPE (TREE_OPERAND (index, 0))))
+ anon_union_init_type = TREE_TYPE (TREE_OPERAND (index, 0));
/* Skip base and vtable inits. */
- if (TREE_CODE (index) != FIELD_DECL
- || DECL_ARTIFICIAL (index))
+ else if (TREE_CODE (index) != FIELD_DECL
+ || DECL_ARTIFICIAL (index))
continue;
}
- for (; field != index; field = DECL_CHAIN (field))
+ for (; field != index && TREE_TYPE (field) != anon_union_init_type;
+ field = DECL_CHAIN (field))
{
tree ftype;
if (TREE_CODE (field) != FIELD_DECL