PR c++/71121 - -Waddress, constexpr, and PMFs.

* cp-gimplify.c (cp_fully_fold): First call maybe_constant_value.

From-SVN: r238559
This commit is contained in:
Jason Merrill 2016-07-21 02:05:33 -04:00 committed by Jason Merrill
parent f078dc7d26
commit e96fe88c51
4 changed files with 25 additions and 17 deletions

View File

@ -1,3 +1,8 @@
2016-07-21 Jason Merrill <jason@redhat.com>
PR c++/71121
* cp-gimplify.c (cp_fully_fold): First call maybe_constant_value.
2016-07-21 Andrew Sutton <andrew.n.sutton@gmail.com>
Jason Merrill <jason@redhat.com>

View File

@ -1954,6 +1954,11 @@ cxx_omp_disregard_value_expr (tree decl, bool shared)
tree
cp_fully_fold (tree x)
{
if (processing_template_decl)
return x;
/* FIXME cp_fold ought to be a superset of maybe_constant_value so we don't
have to call both. */
x = maybe_constant_value (x);
return cp_fold (x);
}

View File

@ -0,0 +1,15 @@
// PR c++/71121
// { dg-do compile { target c++14 } }
// { dg-options -Waddress }
struct CC { void mbr(); };
constexpr auto getFunc() {
return &CC::mbr;
}
constexpr bool xxx(void (CC::*_a)())
{
constexpr auto f = getFunc();
return (f == _a);
}

View File

@ -1,17 +0,0 @@
// PR c/62096 - unexpected warning overflow in implicit constant conversion
// { dg-do compile { target c++11 } }
enum E {
E_val = 1,
};
inline constexpr E operator~(E e)
{
return E(~static_cast<int>(e));
}
int main()
{
int val = ~E_val; // { dg-bogus "overflow in implicit constant conversion" }
(void) val;
}