Commit 9cca4e3d by Jason Merrill Committed by Jason Merrill

re PR c++/58837 ([c++11] ICE using invalid condition in static_assert)

	PR c++/58837
	* typeck.c (cp_truthvalue_conversion): Use explicit comparison for
	FUNCTION_DECL.

From-SVN: r207162
parent 64d34897
2014-01-27 Jason Merrill <jason@redhat.com> 2014-01-27 Jason Merrill <jason@redhat.com>
PR c++/58837
* typeck.c (cp_truthvalue_conversion): Use explicit comparison for
FUNCTION_DECL.
PR c++/59097 PR c++/59097
* decl.c (compute_array_index_type): Don't call * decl.c (compute_array_index_type): Don't call
maybe_constant_value for a non-integral expression. maybe_constant_value for a non-integral expression.
......
...@@ -5182,7 +5182,9 @@ tree ...@@ -5182,7 +5182,9 @@ tree
cp_truthvalue_conversion (tree expr) cp_truthvalue_conversion (tree expr)
{ {
tree type = TREE_TYPE (expr); tree type = TREE_TYPE (expr);
if (TYPE_PTRDATAMEM_P (type)) if (TYPE_PTRDATAMEM_P (type)
/* Avoid ICE on invalid use of non-static member function. */
|| TREE_CODE (expr) == FUNCTION_DECL)
return build_binary_op (EXPR_LOCATION (expr), return build_binary_op (EXPR_LOCATION (expr),
NE_EXPR, expr, nullptr_node, 1); NE_EXPR, expr, nullptr_node, 1);
else if (TYPE_PTR_P (type) || TYPE_PTRMEMFUNC_P (type)) else if (TYPE_PTR_P (type) || TYPE_PTRMEMFUNC_P (type))
......
// PR c++/58837
// { dg-require-effective-target c++11 }
void f();
static_assert(f, "");
struct A {};
static_assert(A::~A, ""); // { dg-error "non-static member function" }
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