re PR c++/51318 (segfault on Eigen3)

PR c++/51318
	* typeck.c (build_x_conditional_expr): Restrict glvalue games to C++11.

From-SVN: r182142
This commit is contained in:
Jason Merrill 2011-12-08 17:28:38 -05:00 committed by Jason Merrill
parent 4eefc795c1
commit 0ee1c847f7
4 changed files with 20 additions and 2 deletions

View File

@ -1,5 +1,8 @@
2011-12-08 Jason Merrill <jason@redhat.com>
PR c++/51318
* typeck.c (build_x_conditional_expr): Restrict glvalue games to C++11.
PR c++/51459
* pt.c (tsubst_expr) [DECL_EXPR]: Handle capture proxies properly.
* semantics.c (insert_capture_proxy): No longer static.

View File

@ -5517,8 +5517,10 @@ build_x_conditional_expr (tree ifexp, tree op1, tree op2,
{
tree min = build_min_non_dep (COND_EXPR, expr,
orig_ifexp, orig_op1, orig_op2);
/* Remember that the result is an lvalue or xvalue. */
if (lvalue_or_rvalue_with_address_p (expr)
/* In C++11, remember that the result is an lvalue or xvalue.
In C++98, lvalue_kind can just assume lvalue in a template. */
if (cxx_dialect >= cxx0x
&& lvalue_or_rvalue_with_address_p (expr)
&& !lvalue_or_rvalue_with_address_p (min))
TREE_TYPE (min) = cp_build_reference_type (TREE_TYPE (min),
!real_lvalue_p (expr));

View File

@ -1,5 +1,8 @@
2011-12-08 Jason Merrill <jason@redhat.com>
PR c++/51318
* g++.dg/template/cond8.C: New.
PR c++/51459
* g++.dg/cpp0x/lambda/lambda-template4.C: New.

View File

@ -0,0 +1,10 @@
// PR c++/51318
enum { e0, e1 };
template<bool B, int = B ? e0 : e1> struct A {};
template<typename T> struct B
{
A<T::X> a;
};