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
+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
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);
--- /dev/null
+// { 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>();
+}