From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 5FC803858D35; Fri, 17 Nov 2023 15:26:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5FC803858D35 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1700234814; bh=R/M95PQJS7qwHLWE8jZ29wSr2lVoZfT1XvuTIBxXF2c=; h=From:To:Subject:Date:From; b=SYxr36xUkv6I+ySgSrFUB4uks/7OZQBxd2Ua03ASjlEeDeoatJ3W+f2uWVq4KZ7x2 tL+nk7kDda+kf8vHnwwnnPY8gcxFUxRzQk33qUvKwvTSq1YDmknh8yUl/jO8/OYLG7 2RRAHqMCq8KEE7RtQiqDR60fvMymSo4hTdetJy2g= From: "janezz55 at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/112590] New: structural constexpr class fails to instantiate Date: Fri, 17 Nov 2023 15:26:53 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: janezz55 at gmail dot com X-Bugzilla-Status: UNCONFIRMED 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: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: 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=3D112590 Bug ID: 112590 Summary: structural constexpr class fails to instantiate Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: janezz55 at gmail dot com Target Milestone: --- Compiling: #include template void test() {} template struct S { int a_[N]; int* f_; constexpr S(): a_{}, f_{a_} {} }; int main() { test{}>(); return 0; } fails with: prog.cc: In function 'int main()': prog.cc:18:16: error: no matching function for call to 'test()>()' 18 | test{}>(); | ~~~~~~~~~~~~~^~ prog.cc:4:6: note: candidate: 'template void test()' 4 | void test() | ^~~~ prog.cc:4:6: note: template argument deduction/substitution failed: prog.cc:18:16: error: 'S<10>{int [10](), ((int*)(&.S<10>::a_))}'= is not a constant expression 18 | test{}>(); | ~~~~~~~~~~~~~^~ prog.cc:18:16: error: 'S<10>()' is not a constant expression because it ref= ers to an incompletely initialized variable But everything is initialized. I believe a workaround exists, but I didn't experiment. https://wandbox.org/permlink/xA81TIzI5XsXdh57=