From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1888) id 16C4D389851D; Thu, 21 Apr 2022 12:35:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 16C4D389851D MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Patrick Palka To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc r12-8214] libstdc++: Work around modules ICE in [PR105297] X-Act-Checkin: gcc X-Git-Author: Patrick Palka X-Git-Refname: refs/heads/master X-Git-Oldrev: cf37107522f465d9e12af01ba68d2d1df0f18d46 X-Git-Newrev: 1e6c0e69af8da436e1d1d2d23d8c38410d78ecf2 Message-Id: <20220421123553.16C4D389851D@sourceware.org> Date: Thu, 21 Apr 2022 12:35:53 +0000 (GMT) X-BeenThere: libstdc++-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libstdc++-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Apr 2022 12:35:53 -0000 https://gcc.gnu.org/g:1e6c0e69af8da436e1d1d2d23d8c38410d78ecf2 commit r12-8214-g1e6c0e69af8da436e1d1d2d23d8c38410d78ecf2 Author: Patrick Palka Date: Thu Apr 21 08:34:59 2022 -0400 libstdc++: Work around modules ICE in [PR105297] This makes the initializer for __table in __from_chars_alnum_to_val dependent in an artificial way, which works around the reported modules testsuite ICE by preventing the compiler from evaluating the initializer parse time. Compared to the alternative workaround of using a non-local class type for __table, this workaround has the advantage of slightly speeding up compilation of , since now the table won't get built (via constexpr evaluation) until the integer std::from_chars overload is instantiated. PR c++/105297 PR c++/105322 libstdc++-v3/ChangeLog: * include/std/charconv (__from_chars_alnum_to_val): Make initializer for __table dependent in an artificial way. Diff: --- libstdc++-v3/include/std/charconv | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libstdc++-v3/include/std/charconv b/libstdc++-v3/include/std/charconv index f1ace406017..561234cb2fc 100644 --- a/libstdc++-v3/include/std/charconv +++ b/libstdc++-v3/include/std/charconv @@ -445,7 +445,9 @@ namespace __detail return __c - '0'; else { - static constexpr auto __table = __from_chars_alnum_to_val_table(); + // This initializer is deliberately made dependent in order to work + // around modules bug PR105322. + static constexpr auto __table = (_DecOnly, __from_chars_alnum_to_val_table()); return __table.__data[__c]; } }