Commit d6ed1c89 by Jason Merrill Committed by Jason Merrill

re PR c++/46977 ([C++0x] ICE: SIGSEGV in htab_find_slot_with_hash (hashtab.c:650))

	PR c++/46977
	* semantics.c (potential_constant_expression_1): Split out from
	potential_constant_expression.  Add want_rval parm.  Handle
	template expression forms.  Don't enforce restriction on address
	of automatic variable here.  Add a couple of diagnostics that
	had been missing.
	(require_potential_constant_expression): New entry point.
	(build_data_member_initialization, register_constexpr_fundef): Adjust.
	(maybe_constant_value): Check potential_constant_expression.
	* pt.c (fold_non_dependent_expr_sfinae): Likewise.
	* tree.c (build_vec_init_expr): Adjust.

From-SVN: r169096
parent e90b336f
2011-01-21 Jason Merrill <jason@redhat.com>
PR c++/46977
* semantics.c (potential_constant_expression_1): Split out from
potential_constant_expression. Add want_rval parm. Handle
template expression forms. Don't enforce restriction on address
of automatic variable here. Add a couple of diagnostics that
had been missing.
(require_potential_constant_expression): New entry point.
(build_data_member_initialization, register_constexpr_fundef): Adjust.
(maybe_constant_value): Check potential_constant_expression.
* pt.c (fold_non_dependent_expr_sfinae): Likewise.
* tree.c (build_vec_init_expr): Adjust.
2011-01-19 Jakub Jelinek <jakub@redhat.com>
PR c++/47303
......
......@@ -5245,7 +5245,8 @@ extern tree validate_constexpr_fundecl (tree);
extern tree register_constexpr_fundef (tree, tree);
extern bool check_constexpr_ctor_body (tree, tree);
extern tree ensure_literal_type_for_constexpr_object (tree);
extern bool potential_constant_expression (tree, tsubst_flags_t);
extern bool potential_constant_expression (tree);
extern bool require_potential_constant_expression (tree);
extern tree cxx_constant_value (tree);
extern tree maybe_constant_value (tree);
extern tree maybe_constant_init (tree);
......
......@@ -5159,6 +5159,7 @@ fold_non_dependent_expr_sfinae (tree expr, tsubst_flags_t complain)
as two declarations of the same function, for example. */
if (processing_template_decl
&& !type_dependent_expression_p (expr)
&& potential_constant_expression (expr)
&& !value_dependent_expression_p (expr))
{
HOST_WIDE_INT saved_processing_template_decl;
......@@ -17964,11 +17965,11 @@ dependent_scope_p (tree scope)
[temp.dep.constexpr]. EXPRESSION is already known to be a constant
expression. */
/* FIXME this predicate is not appropriate for general expressions; the
predicates we want instead are "valid constant expression, value
dependent or not?", "really constant expression, not value dependent?"
and "instantiation-dependent?". Try to integrate with
potential_constant_expression?
/* Note that this predicate is not appropriate for general expressions;
only constant expressions (that satisfy potential_constant_expression)
can be tested for value dependence.
We should really also have a predicate for "instantiation-dependent".
fold_non_dependent_expr: fold if constant and not type-dependent and not value-dependent.
(what about instantiation-dependent constant-expressions?)
......
......@@ -513,9 +513,13 @@ build_vec_init_expr (tree type, tree init)
SET_EXPR_LOCATION (init, input_location);
if (current_function_decl
&& DECL_DECLARED_CONSTEXPR_P (current_function_decl)
&& potential_constant_expression (elt_init, tf_warning_or_error))
VEC_INIT_EXPR_IS_CONSTEXPR (init) = true;
&& DECL_DECLARED_CONSTEXPR_P (current_function_decl))
{
if (potential_constant_expression (elt_init))
VEC_INIT_EXPR_IS_CONSTEXPR (init) = true;
else if (!processing_template_decl)
require_potential_constant_expression (elt_init);
}
VEC_INIT_EXPR_VALUE_INIT (init) = value_init;
init = build_target_expr (slot, init);
......
2011-01-21 Jason Merrill <jason@redhat.com>
* g++.dg/cpp0x/constexpr-stmtexpr.C: New.
2011-01-21 Jeff Law <law@redhat.com>
PR rtl-optimization/41619
......
// PR c++/46977
// { dg-options "-std=c++0x" }
template < typename > void
foo ()
{
({int i;}), 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment