public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r11-8705] Revert "c++: Improve init handling"
@ 2021-07-07 22:50 Jason Merrill
0 siblings, 0 replies; only message in thread
From: Jason Merrill @ 2021-07-07 22:50 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:79663c962588e8c033ff39be39e938e2cc866e12
commit r11-8705-g79663c962588e8c033ff39be39e938e2cc866e12
Author: Jason Merrill <jason@redhat.com>
Date: Wed Jul 7 17:57:40 2021 -0400
Revert "c++: Improve init handling"
Apparently looking through these codes means that in a template, we end up
feeding a TARGET_EXPR to fold_non_dependent_expr, which should never
happen. This is a broader issue, but for now let's just revert the change.
This reverts commit d9288bd28e24c755a7216311ee5247e7c88270a6.
PR c++/101072
gcc/cp/ChangeLog:
* decl.c (check_initializer): Don't look through STMT_EXPR and
BIND_EXPR.
gcc/testsuite/ChangeLog:
* g++.dg/cpp0x/constexpr-empty14.C: Add -fno-elide-constructors.
Diff:
---
gcc/cp/decl.c | 14 +++-----------
gcc/testsuite/g++.dg/cpp0x/constexpr-empty14.C | 1 +
2 files changed, 4 insertions(+), 11 deletions(-)
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 0ed15f53596..9cfe62a98ee 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -7052,17 +7052,9 @@ check_initializer (tree decl, tree init, int flags, vec<tree, va_gc> **cleanups)
have returned an INIT_EXPR rather than a CALL_EXPR. In that
case, pull the initializer back out and pass it down into
store_init_value. */
- while (true)
- {
- if (TREE_CODE (init_code) == EXPR_STMT
- || TREE_CODE (init_code) == STMT_EXPR
- || TREE_CODE (init_code) == CONVERT_EXPR)
- init_code = TREE_OPERAND (init_code, 0);
- else if (TREE_CODE (init_code) == BIND_EXPR)
- init_code = BIND_EXPR_BODY (init_code);
- else
- break;
- }
+ while (TREE_CODE (init_code) == EXPR_STMT
+ || TREE_CODE (init_code) == CONVERT_EXPR)
+ init_code = TREE_OPERAND (init_code, 0);
if (TREE_CODE (init_code) == INIT_EXPR)
{
/* In C++20, the call to build_aggr_init could have created
diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-empty14.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-empty14.C
index ca4f9a55e5f..a2d498f82ae 100644
--- a/gcc/testsuite/g++.dg/cpp0x/constexpr-empty14.C
+++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-empty14.C
@@ -1,5 +1,6 @@
// PR c++/91953
// { dg-do compile { target c++11 } }
+// { dg-additional-options -fno-elide-constructors { target c++14_down } }
struct S {};
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-07-07 22:50 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-07 22:50 [gcc r11-8705] Revert "c++: Improve init handling" Jason Merrill
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).