Commit b7df43cd by Jason Merrill Committed by Jason Merrill

re PR c++/56481 (endless loop compiling a C++ file)

	PR c++/56481
	* semantics.c (potential_constant_expression_1): Use of 'this' in
	a non-constexpr function makes the expression not potentially
	constant.

From-SVN: r196737
parent 57fcd4f4
2013-03-16 Jason Merrill <jason@redhat.com>
PR c++/56481
* semantics.c (potential_constant_expression_1): Use of 'this' in
a non-constexpr function makes the expression not potentially
constant.
N3276
PR c++/52748
* cp-tree.h (tsubst_flags): Add tf_decltype.
......
......@@ -8497,6 +8497,13 @@ potential_constant_expression_1 (tree t, bool want_rval, tsubst_flags_t flags)
STRIP_NOPS (x);
if (is_this_parameter (x))
{
if (DECL_CONTEXT (x)
&& !DECL_DECLARED_CONSTEXPR_P (DECL_CONTEXT (x)))
{
if (flags & tf_error)
error ("use of %<this%> in a constant expression");
return false;
}
if (want_rval && DECL_CONTEXT (x)
&& DECL_CONSTRUCTOR_P (DECL_CONTEXT (x)))
{
......
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