Summary: | [6/7 Regression] Supposedly-incompliant "error: '* key0' is not a constant expression" | ||
---|---|---|---|
Product: | gcc | Reporter: | sergey.ignatchenko |
Component: | c++ | Assignee: | Jakub Jelinek <jakub> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | daniel.kruegler, webrown.cpp |
Priority: | P2 | Keywords: | rejects-valid |
Version: | 7.2.0 | ||
Target Milestone: | 6.5 | ||
Host: | Target: | ||
Build: | Known to work: | 5.5.0 | |
Known to fail: | 6.4.0, 7.3.0, 8.0.1 | Last reconfirmed: | 2018-04-16 00:00:00 |
Attachments: | gcc8-pr84463.patch |
Description
sergey.ignatchenko
2018-02-19 13:25:52 UTC
oops, forgot to mention command line: g++ -std=c++1z -lstdc++ -Werror ../chachatest.cpp where chachatest.cpp is provided in "CODE" section above Started to fail with r230365 ("Merge C++ delayed folding branch.") Created attachment 43948 [details] gcc8-pr84463.patch Untested fix. Author: jakub Date: Wed Apr 18 06:57:45 2018 New Revision: 259458 URL: https://gcc.gnu.org/viewcvs?rev=259458&root=gcc&view=rev Log: PR c++/84463 * typeck.c (cp_build_addr_expr_1): Move handling of offsetof-like tricks from here to ... * cp-gimplify.c (cp_fold) <case ADDR_EXPR>: ... here. Only use it if INDIRECT_REF's operand is INTEGER_CST cast to pointer type. * g++.dg/cpp0x/constexpr-nullptr-1.C: Add -O1 to dg-options. * g++.dg/cpp0x/constexpr-nullptr-2.C: Expect different diagnostics in two cases. Uncomment two other tests and add expected dg-error for them. * g++.dg/init/struct2.C: Cast to int rather than long to avoid -Wnarrowing diagnostics on some targets for c++11. * g++.dg/parse/array-size2.C: Remove xfail. * g++.dg/cpp0x/constexpr-84463.C: New test. Added: trunk/gcc/testsuite/g++.dg/cpp0x/constexpr-84463.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/cp-gimplify.c trunk/gcc/cp/typeck.c trunk/gcc/testsuite/ChangeLog trunk/gcc/testsuite/g++.dg/cpp0x/constexpr-nullptr-1.C trunk/gcc/testsuite/g++.dg/cpp0x/constexpr-nullptr-2.C trunk/gcc/testsuite/g++.dg/init/struct2.C trunk/gcc/testsuite/g++.dg/parse/array-size2.C Fixed for 8+. Not really sure if this patch should be backported. . Author: jakub Date: Fri Jun 22 21:12:32 2018 New Revision: 261956 URL: https://gcc.gnu.org/viewcvs?rev=261956&root=gcc&view=rev Log: Backported from mainline 2018-04-18 Jakub Jelinek <jakub@redhat.com> PR c++/84463 * typeck.c (cp_build_addr_expr_1): Move handling of offsetof-like tricks from here to ... * cp-gimplify.c (cp_fold) <case ADDR_EXPR>: ... here. Only use it if INDIRECT_REF's operand is INTEGER_CST cast to pointer type. * g++.dg/cpp0x/constexpr-nullptr-1.C: Add -O1 to dg-options. * g++.dg/cpp0x/constexpr-nullptr-2.C: Expect different diagnostics in two cases. Uncomment two other tests and add expected dg-error for them. * g++.dg/init/struct2.C: Cast to int rather than long to avoid -Wnarrowing diagnostics on some targets for c++11. * g++.dg/parse/array-size2.C: Remove xfail. * g++.dg/cpp0x/constexpr-84463.C: New test. Added: branches/gcc-7-branch/gcc/testsuite/g++.dg/cpp0x/constexpr-84463.C Modified: branches/gcc-7-branch/gcc/cp/ChangeLog branches/gcc-7-branch/gcc/cp/cp-gimplify.c branches/gcc-7-branch/gcc/cp/typeck.c branches/gcc-7-branch/gcc/testsuite/ChangeLog branches/gcc-7-branch/gcc/testsuite/g++.dg/cpp0x/constexpr-nullptr-1.C branches/gcc-7-branch/gcc/testsuite/g++.dg/cpp0x/constexpr-nullptr-2.C branches/gcc-7-branch/gcc/testsuite/g++.dg/init/struct2.C branches/gcc-7-branch/gcc/testsuite/g++.dg/parse/array-size2.C |