Commit e96fe88c by Jason Merrill Committed by Jason Merrill

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

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

From-SVN: r238559
parent f078dc7d
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> 2016-07-21 Andrew Sutton <andrew.n.sutton@gmail.com>
Jason Merrill <jason@redhat.com> Jason Merrill <jason@redhat.com>
......
...@@ -1954,6 +1954,11 @@ cxx_omp_disregard_value_expr (tree decl, bool shared) ...@@ -1954,6 +1954,11 @@ cxx_omp_disregard_value_expr (tree decl, bool shared)
tree tree
cp_fully_fold (tree x) 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); return cp_fold (x);
} }
......
// 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);
}
// 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;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment