Commit 3d8695f5 by Jason Merrill Committed by Jason Merrill

Avoid ICE on pmf{} in template.

Now that we return the original CONSTRUCTOR from finish_compound_literal,
the call to null_member_pointer_value_p in tsubst_copy_and_build was getting
confused because the CONSTRUCTOR was still empty rather than a valid PMF
value.

	* call.c (null_member_pointer_value_p): Handle an empty CONSTRUCTOR
	of PMF type.

From-SVN: r270324
parent 76416d89
2019-04-12 Jason Merrill <jason@redhat.com>
* call.c (null_member_pointer_value_p): Handle an empty CONSTRUCTOR
of PMF type.
2019-04-12 Marek Polacek <polacek@redhat.com>
* except.c (build_noexcept_spec): Use build_converted_constant_bool_expr
......
......@@ -569,6 +569,7 @@ null_member_pointer_value_p (tree t)
return false;
else if (TYPE_PTRMEMFUNC_P (type))
return (TREE_CODE (t) == CONSTRUCTOR
&& CONSTRUCTOR_NELTS (t)
&& integer_zerop (CONSTRUCTOR_ELT (t, 0)->value));
else if (TYPE_PTRDATAMEM_P (type))
return integer_all_onesp (t);
......
// { dg-do compile { target c++11 } }
struct A
{
void f();
};
using ftype = decltype(&A::f);
template <class T>
bool f()
{
ftype p = ftype{};
return p;
}
int main()
{
f<int>();
}
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