PR c++/80485 - inline function non-zero address.
* symtab.c (nonzero_address): Check DECL_COMDAT. From-SVN: r260762
This commit is contained in:
parent
18b119378a
commit
f22ed1ed2a
@ -1,3 +1,8 @@
|
||||
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
|
||||
|
@ -1959,11 +1959,11 @@ symtab_node::nonzero_address ()
|
||||
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))
|
||||
|
15
gcc/testsuite/g++.dg/expr/pmf-3.C
Normal file
15
gcc/testsuite/g++.dg/expr/pmf-3.C
Normal file
@ -0,0 +1,15 @@
|
||||
// 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 ), "" );
|
Loading…
x
Reference in New Issue
Block a user