+2018-05-25 Jason Merrill <jason@redhat.com>
+
+ PR c++/80485 - inline function non-zero address.
+ * symtab.c (nonzero_address): Check DECL_COMDAT.
+
2018-05-25 Uros Bizjak <ubizjak@gmail.com>
PR target/83628
return true;
}
- /* If target is defined and not extern, we know it will be output and thus
- it will bind to non-NULL.
- Play safe for flag_delete_null_pointer_checks where weak definition maye
+ /* If target is defined and either comdat or not extern, we know it will be
+ output and thus it will bind to non-NULL.
+ Play safe for flag_delete_null_pointer_checks where weak definition may
be re-defined by NULL. */
- if (definition && !DECL_EXTERNAL (decl)
+ if (definition && (!DECL_EXTERNAL (decl) || DECL_COMDAT (decl))
&& (flag_delete_null_pointer_checks || !DECL_WEAK (decl)))
{
if (!DECL_WEAK (decl))
--- /dev/null
+// PR c++/80485
+// { dg-do compile { target c++11 } }
+
+struct dummy {
+ void nonnull() {};
+ void nonnull2();
+};
+
+typedef void (dummy::*safe_bool)();
+
+constexpr safe_bool a = &dummy::nonnull;
+constexpr safe_bool b = &dummy::nonnull2;
+
+static_assert( static_cast<bool>( a ), "" );
+static_assert( static_cast<bool>( b ), "" );