public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/104620] FAIL: g++.dg/cpp23/consteval-if2.C -std=gnu++20 (test for errors) Date: Thu, 24 Mar 2022 12:21:36 +0000 [thread overview] Message-ID: <bug-104620-4-jrlCft7oPZ@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-104620-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104620 Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Reduced testcase for -std=c++23 consteval int foo (int x) { return x; } consteval int bar () { return 2; } template <typename T> constexpr int qux (int x) { int r = 0; if consteval { r += 2 * bar (); } else { r += foo (8 * x); // { dg-error "is not a constant expression" } } if ! consteval { r += foo (32 * x);// { dg-error "is not a constant expression" } } if consteval { r += 32 * bar (); } return r; } The intent of the testcase was to test whether we catch at least some of the non-dependent consteval calls already during template parsing and so regardless of whether we actually instantiate them or not. Worst case it will be diagnosed during instantiation, sure. But x is not type nor value dependent and neither is 8 * x nor 32 * x. And make_args_non_dependent calls build_non_dependent_arg which will not wrap say x or 8, but does wrap x * 8 even when both arguments have integral types. So, either build_non_dependent_arg should be made smarter and not wrap even simple arithmetics etc. where no C++ template-ish trees appear inside of it and everything is like in normal non-template-ish code, or we should reconsider the r12-7264 case because clearly often we can handle NON_DEPENDENT_EXPR just fine.
next prev parent reply other threads:[~2022-03-24 12:21 UTC|newest] Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-02-21 19:38 [Bug c++/104620] New: " danglin at gcc dot gnu.org 2022-03-23 18:04 ` [Bug c++/104620] " mpolacek at gcc dot gnu.org 2022-03-23 18:42 ` mpolacek at gcc dot gnu.org 2022-03-23 20:35 ` ppalka at gcc dot gnu.org 2022-03-24 12:21 ` jakub at gcc dot gnu.org [this message] 2022-03-24 13:29 ` jakub at gcc dot gnu.org 2022-03-24 13:31 ` ppalka at gcc dot gnu.org 2022-03-24 13:37 ` ppalka at gcc dot gnu.org 2022-03-24 14:29 ` ppalka at gcc dot gnu.org 2022-03-24 15:21 ` jason at gcc dot gnu.org 2022-03-24 15:42 ` cvs-commit at gcc dot gnu.org 2022-03-24 17:19 ` ppalka at gcc dot gnu.org 2022-03-26 23:01 ` jason at gcc dot gnu.org 2022-05-06 8:32 ` jakub at gcc dot gnu.org 2023-05-08 12:23 ` rguenth at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-104620-4-jrlCft7oPZ@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).