From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id CAF833858C5E; Tue, 2 Apr 2024 14:26:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CAF833858C5E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1712068011; bh=2wHdPJIa7L26Edu4Vqd0m+m1McSXM9FAZBB8L2P4wYs=; h=From:To:Subject:Date:In-Reply-To:References:From; b=PLXS9TENRM+aIlJ0Ht+5ohALyyyTq5rwINrKP1XTtjk3KcrM7VpIqAuMrqoOuBCnd LKkF/VCHPAfMHruh9xvoNC64k4Swlt1fF3CwyObdQgtiGMz2TtJ3syD01R5E1BiXrR YiVj4RyHoVuvybQyGZzAFvp389GuMDGiIEKtgWg8= From: "jlame646 at gmail dot com" 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: accepts-invalid X-Bugzilla-Severity: normal X-Bugzilla-Who: jlame646 at gmail dot com X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D107945 --- Comment #4 from Jason Liam --- Here is another invalid snippet that gcc accepts but both clang and msvc rejects correctly. https://godbolt.org/z/sz4rczEaG ``` #include template requires std::is_arithmetic_v && (N >=3D 1) class Vector { static constexpr std::size_t Dimension =3D N; std::array Elements; public: constexpr Vector() noexcept : Elements{} {} constexpr ~Vector() =3D default; static constexpr Vector ZeroVector{}; }; int main() { Vector boo =3D Vector::ZeroVector; } ``` Related thread https://stackoverflow.com/questions/78248691/static-data-member-of-template= -class-type-constexpr-vs-const-constinit=