public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "jlame646 at gmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/107945] static constexpr incomplete (depedent) data member of a class template and in-member initialized incorrectly accepted Date: Tue, 02 Apr 2024 14:26:50 +0000 [thread overview] Message-ID: <bug-107945-4-WgWO4YpPJc@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-107945-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107945 --- Comment #4 from Jason Liam <jlame646 at gmail dot com> --- Here is another invalid snippet that gcc accepts but both clang and msvc rejects correctly. https://godbolt.org/z/sz4rczEaG ``` #include <array> template<class T, std::size_t N> requires std::is_arithmetic_v<T> && (N >= 1) class Vector { static constexpr std::size_t Dimension = N; std::array<T, Dimension> Elements; public: constexpr Vector() noexcept : Elements{} {} constexpr ~Vector() = default; static constexpr Vector ZeroVector{}; }; int main() { Vector<float, 7> boo = Vector<float, 7>::ZeroVector; } ``` Related thread https://stackoverflow.com/questions/78248691/static-data-member-of-template-class-type-constexpr-vs-const-constinit
next prev parent reply other threads:[~2024-04-02 14:26 UTC|newest] Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-12-01 13:20 [Bug c++/107945] New: GCC accepts invalid program involving constexpr static data member of class template jlame646 at gmail dot com 2022-12-01 20:09 ` [Bug c++/107945] " pinskia at gcc dot gnu.org 2022-12-01 20:10 ` pinskia at gcc dot gnu.org 2022-12-01 20:13 ` [Bug c++/107945] static constexpr incomplete (depedent) data member of a class template and in-member initialized accepted pinskia at gcc dot gnu.org 2024-04-02 14:26 ` jlame646 at gmail dot com [this message] 2024-04-03 1:28 ` [Bug c++/107945] static constexpr incomplete (depedent) data member of a class template and in-member initialized incorrectly accepted bbi5291 at gmail dot com 2024-05-03 7:58 ` jlame646 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-107945-4-WgWO4YpPJc@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).