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:
parent
f078dc7d26
commit
e96fe88c51
@ -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>
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
15
gcc/testsuite/g++.dg/warn/Waddress-4.C
Normal file
15
gcc/testsuite/g++.dg/warn/Waddress-4.C
Normal 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);
|
||||
}
|
@ -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;
|
||||
}
|
Loading…
Reference in New Issue
Block a user