summaryrefslogtreecommitdiff
path: root/gcc/cp/call.c
diff options
context:
space:
mode:
authorbviyer <bviyer@138bc75d-0d04-0410-961f-82ee72b054a4>2012-10-10 19:12:49 +0000
committerbviyer <bviyer@138bc75d-0d04-0410-961f-82ee72b054a4>2012-10-10 19:12:49 +0000
commitdf4a6f64445977556663fde8b68aa94de3208214 (patch)
tree5d52c609ff45125f595ac5f180ab05c18ebce7f1 /gcc/cp/call.c
parent2e8eb49ca46425587d7cac3f6851cf562e2e45ff (diff)
parentd3cb8b936e82644d3a416fdec57fdd3a319a67c8 (diff)
downloadgcc-df4a6f64445977556663fde8b68aa94de3208214.tar.gz
Merged with trunk at revision 192287.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/cilkplus@192327 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/call.c')
-rw-r--r--gcc/cp/call.c34
1 files changed, 23 insertions, 11 deletions
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index 3b9b0a8dea7..4aa9d5b75f1 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -561,7 +561,7 @@ null_ptr_cst_p (tree t)
{
/* Core issue 903 says only literal 0 is a null pointer constant. */
if (cxx_dialect < cxx0x)
- t = integral_constant_value (t);
+ t = maybe_constant_value (t);
STRIP_NOPS (t);
if (integer_zerop (t) && !TREE_OVERFLOW (t))
return true;
@@ -4783,7 +4783,7 @@ build_conditional_expr_1 (tree arg1, tree arg2, tree arg3,
but now we sometimes wrap them in NOP_EXPRs so the test would
fail. */
if (CLASS_TYPE_P (TREE_TYPE (result)))
- result = get_target_expr (result);
+ result = get_target_expr_sfinae (result, complain);
/* If this expression is an rvalue, but might be mistaken for an
lvalue, we must add a NON_LVALUE_EXPR. */
result = rvalue (result);
@@ -5903,7 +5903,7 @@ convert_like_real (conversion *convs, tree expr, tree fn, int argnum,
field = next_initializable_field (DECL_CHAIN (field));
CONSTRUCTOR_APPEND_ELT (vec, field, size_int (len));
new_ctor = build_constructor (totype, vec);
- return get_target_expr (new_ctor);
+ return get_target_expr_sfinae (new_ctor, complain);
}
case ck_aggr:
@@ -5919,7 +5919,8 @@ convert_like_real (conversion *convs, tree expr, tree fn, int argnum,
return fold_if_not_in_template (expr);
}
expr = reshape_init (totype, expr, complain);
- return get_target_expr (digest_init (totype, expr, complain));
+ return get_target_expr_sfinae (digest_init (totype, expr, complain),
+ complain);
default:
break;
@@ -8743,9 +8744,9 @@ perform_direct_initialization_if_possible (tree type,
The next several functions are involved in this lifetime extension. */
-/* DECL is a VAR_DECL whose type is a REFERENCE_TYPE. The reference
- is being bound to a temporary. Create and return a new VAR_DECL
- with the indicated TYPE; this variable will store the value to
+/* DECL is a VAR_DECL or FIELD_DECL whose type is a REFERENCE_TYPE. The
+ reference is being bound to a temporary. Create and return a new
+ VAR_DECL with the indicated TYPE; this variable will store the value to
which the reference is bound. */
tree
@@ -8757,13 +8758,15 @@ make_temporary_var_for_ref_to_temp (tree decl, tree type)
var = create_temporary_var (type);
/* Register the variable. */
- if (TREE_STATIC (decl))
+ if (TREE_CODE (decl) == VAR_DECL
+ && (TREE_STATIC (decl) || DECL_THREAD_LOCAL_P (decl)))
{
/* Namespace-scope or local static; give it a mangled name. */
/* FIXME share comdat with decl? */
tree name;
- TREE_STATIC (var) = 1;
+ TREE_STATIC (var) = TREE_STATIC (decl);
+ DECL_TLS_MODEL (var) = DECL_TLS_MODEL (decl);
name = mangle_ref_init_variable (decl);
DECL_NAME (var) = name;
SET_DECL_ASSEMBLER_NAME (var, name);
@@ -8817,6 +8820,9 @@ set_up_extended_ref_temp (tree decl, tree expr, VEC(tree,gc) **cleanups,
TARGET_EXPR_INITIAL (expr)
= extend_ref_init_temps (decl, TARGET_EXPR_INITIAL (expr), cleanups);
+ /* Any reference temp has a non-trivial initializer. */
+ DECL_NONTRIVIALLY_INITIALIZED_P (var) = true;
+
/* If the initializer is constant, put it in DECL_INITIAL so we get
static initialization and use in constant expressions. */
init = maybe_constant_init (expr);
@@ -8879,8 +8885,14 @@ set_up_extended_ref_temp (tree decl, tree expr, VEC(tree,gc) **cleanups,
{
rest_of_decl_compilation (var, /*toplev=*/1, at_eof);
if (TYPE_HAS_NONTRIVIAL_DESTRUCTOR (type))
- static_aggregates = tree_cons (NULL_TREE, var,
- static_aggregates);
+ {
+ if (DECL_THREAD_LOCAL_P (var))
+ tls_aggregates = tree_cons (NULL_TREE, var,
+ tls_aggregates);
+ else
+ static_aggregates = tree_cons (NULL_TREE, var,
+ static_aggregates);
+ }
}
*initp = init;