+2017-02-27 Jason Merrill <jason@redhat.com>
+
+ PR c++/71568 - SFINAE forming pointer to member function
+ * init.c (build_offset_ref): Check the return value of
+ perform_or_defer_access_check.
+
2017-02-27 Marek Polacek <polacek@redhat.com>
* decl.c (expand_static_init): Add missing } in a comment.
If the access is to form a pointer to member, the
nested-name-specifier shall name the derived class
(or any class derived from that class). */
+ bool ok;
if (address_p && DECL_P (t)
&& DECL_NONSTATIC_MEMBER_P (t))
- perform_or_defer_access_check (TYPE_BINFO (type), t, t,
- complain);
+ ok = perform_or_defer_access_check (TYPE_BINFO (type), t, t,
+ complain);
else
- perform_or_defer_access_check (basebinfo, t, t,
- complain);
-
+ ok = perform_or_defer_access_check (basebinfo, t, t,
+ complain);
+ if (!ok)
+ return error_mark_node;
if (DECL_STATIC_FUNCTION_P (t))
return t;
member = t;
TREE_TYPE (member) = unknown_type_node;
}
else if (address_p && TREE_CODE (member) == FIELD_DECL)
- /* We need additional test besides the one in
- check_accessibility_of_qualified_id in case it is
- a pointer to non-static member. */
- perform_or_defer_access_check (TYPE_BINFO (type), member, member,
- complain);
+ {
+ /* We need additional test besides the one in
+ check_accessibility_of_qualified_id in case it is
+ a pointer to non-static member. */
+ if (!perform_or_defer_access_check (TYPE_BINFO (type), member, member,
+ complain))
+ return error_mark_node;
+ }
if (!address_p)
{
--- /dev/null
+// PR c++/71568
+// { dg-do compile { target c++11 } }
+
+template <typename T> class F : T {};
+template <typename> using void_t = void;
+template <class, class = void> struct G;
+template <typename T> struct G<T, void_t<decltype(&T::nlog_custom)>> {};
+struct D {
+ void nlog_custom();
+};
+G<F<D>> g; // { dg-error "incomplete" }
+