diff options
| author | Jason Merrill <jason@redhat.com> | 2020-01-15 14:45:24 -0500 |
|---|---|---|
| committer | Jason Merrill <jason@redhat.com> | 2020-01-15 15:12:03 -0500 |
| commit | 596334fa040094c772965ff1998d171fe3e00348 (patch) | |
| tree | efcc88169fe8ace60a2df21656b5d7d0ab2f6a4c /gcc/cp/constexpr.c | |
| parent | 7192b1ec12484f5ca8b20930d8dc4d28ab4a533a (diff) | |
| download | gcc-596334fa040094c772965ff1998d171fe3e00348.zip gcc-596334fa040094c772965ff1998d171fe3e00348.tar.gz gcc-596334fa040094c772965ff1998d171fe3e00348.tar.bz2 | |
PR c++/93257 - consteval void function.
A prvalue can have void type, and if it doesn't do anything prohibited in a
constant expression, it's vacuously constant.
* constexpr.c (verify_constant): Allow void_node.
Diffstat (limited to 'gcc/cp/constexpr.c')
| -rw-r--r-- | gcc/cp/constexpr.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/gcc/cp/constexpr.c b/gcc/cp/constexpr.c index bb126a9..17b04d7 100644 --- a/gcc/cp/constexpr.c +++ b/gcc/cp/constexpr.c @@ -2609,7 +2609,8 @@ static bool verify_constant (tree t, bool allow_non_constant, bool *non_constant_p, bool *overflow_p) { - if (!*non_constant_p && !reduced_constant_expression_p (t)) + if (!*non_constant_p && !reduced_constant_expression_p (t) + && t != void_node) { if (!allow_non_constant) error ("%q+E is not a constant expression", t); |
