public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "glenjofe at gmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/105553] New: Deduction when attempting to create an array with an element type that is an abstract class Date: Tue, 10 May 2022 18:36:32 +0000 [thread overview] Message-ID: <bug-105553-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105553 Bug ID: 105553 Summary: Deduction when attempting to create an array with an element type that is an abstract class Product: gcc Version: 11.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: glenjofe at gmail dot com Target Milestone: --- Starting with GCC11, the following definition of a trait to check if a type is abstract no longer works in any standard mode: template<class T> class is_abstract { template<class U> static char (&check(U(*)[1]))[2]; template<class U> static char check(...); public: static const bool value = sizeof(check<T>(0)) == sizeof(char); }; struct abstract { virtual void function() = 0; }; static_assert(is_abstract<abstract>::value, "ok"); The static assertion trigger on GCC11 and above, even in older standard modes. It compiles fine on GCC10 and below. Various libraries in Boost use the above definition of is_abstract especially in C++03. The basis was the following wording in [temp.deduct] until C++17: "Type deduction may fail for the following reasons: - Attempting to create an array with an element type that is void, a function type, a reference type, or an abstract class type, or attempting to create an array with a size that is zero or negative." The "or an abstract class type" was absent in C++03, added by CWG337.
next reply other threads:[~2022-05-10 18:36 UTC|newest] Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-05-10 18:36 glenjofe at gmail dot com [this message] 2022-05-11 7:38 ` [Bug c++/105553] [11/12/13 Regression] " rguenth at gcc dot gnu.org 2022-05-16 16:44 ` [Bug c++/105553] [11/12/13 Regression] [DR1640] " jason at gcc dot gnu.org 2022-05-16 16:46 ` jason at gcc dot gnu.org 2022-05-16 21:14 ` glenjofe at gmail dot com
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-105553-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).