public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "peeceseven at gmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/103480] New: [10,11,12]Werror=useless-cast with constexpr destructor Date: Mon, 29 Nov 2021 22:51:14 +0000 [thread overview] Message-ID: <bug-103480-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103480 Bug ID: 103480 Summary: [10,11,12]Werror=useless-cast with constexpr destructor Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: peeceseven at gmail dot com Target Milestone: --- Created attachment 51901 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51901&action=edit sample that causes the bug. https://godbolt.org/z/vsdd6M6cc Issue: useless cast error triggers somehow when we have a constexpr destructor. GCC 9 doesn't support c++20's constexpr destructor. But this problem exists in 10,11,12, and trunk. Code compiles on clang and msvc. //error output <source>: In instantiation of 'static constexpr auto scope_guard::array(void (*)()) [with long unsigned int count = 2]': <source>:82:45: required from here <source>:69:12: in 'constexpr' expansion of 'std::array<scope_guard, 2>(r)' <source>:69:12: error: useless cast to type 'struct scope_guard&&' [-Werror=useless-cast] 69 | return r; | ^ <source>: In function 'int main()': <source>:82:51: in 'constexpr' expansion of 'scope_guard::array(void (*)()) [with long unsigned int count = 2]()' <source>:69:12: in 'constexpr' expansion of 'std::array<scope_guard, 2>(r)' <source>:82:51: error: useless cast to type 'struct scope_guard&&' [-Werror=useless-cast] 82 | constexpr auto t = scope_guard::array<2>(&test); | ^ <source>:82:51: in 'constexpr' expansion of 'scope_guard::array(void (*)()) [with long unsigned int count = 2]()' <source>:69:12: in 'constexpr' expansion of 'std::array<scope_guard, 2>(r)' <source>:82:51: error: useless cast to type 'struct scope_guard&&' [-Werror=useless-cast] cc1plus: some warnings being treated as errors Compiler returned: 1
next reply other threads:[~2021-11-29 22:51 UTC|newest] Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-11-29 22:51 peeceseven at gmail dot com [this message] 2021-11-29 23:06 ` [Bug c++/103480] -Werror=useless-cast " mpolacek at gcc dot gnu.org 2021-11-30 0:11 ` mpolacek at gcc dot gnu.org 2021-11-30 0:46 ` [Bug c++/103480] [10/11/12 Regression] " mpolacek at gcc dot gnu.org 2021-11-30 0:52 ` mpolacek at gcc dot gnu.org 2021-12-30 17:49 ` jakub at gcc dot gnu.org 2022-01-12 8:49 ` cvs-commit at gcc dot gnu.org 2022-01-12 8:53 ` [Bug c++/103480] [10/11 " jakub at gcc dot gnu.org 2022-01-24 9:21 ` cvs-commit at gcc dot gnu.org 2022-01-24 9:28 ` [Bug c++/103480] [10 " jakub at gcc dot gnu.org 2022-05-10 8:22 ` cvs-commit at gcc dot gnu.org 2022-05-10 10:14 ` jakub 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-103480-4@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).