libstdc++: Redefine __from_chars_alnum_to_val's table
commit7bf3a4d36a8e59297ea65dd479ffe696f0974303
authorPatrick Palka <ppalka@redhat.com>
Thu, 20 Oct 2022 14:30:31 +0000 (20 10:30 -0400)
committerPatrick Palka <ppalka@redhat.com>
Thu, 20 Oct 2022 14:30:31 +0000 (20 10:30 -0400)
treea56d379e4b7cd8a4cde3a28807e3ce3e751c18cd
parentf4fda3eec408e1eb12cc966f55f0de396be71597
libstdc++: Redefine __from_chars_alnum_to_val's table

After the C++23 constexpr <charconv> patch r13-3313-g378a0f1840e694 we
have some modules testsuite regressions:

  FAIL: g++.dg/modules/xtreme-header-4_b.C -std=c++2b (test for excess errors)
  FAIL: g++.dg/modules/xtreme-header_b.C -std=c++2b (test for excess errors)

Like with PR105297, the cause seems to be the deduced type of __table
resolving ahead of time to a local class type, which trips up modules.
And unfortunately that PR's minimal workaround of making __tables's
initializer value dependent doesn't help in this case.

So this patch works around this by avoiding using a local class for the
table type.  And I suppose we should use a static data member to define
the table once for all dialects (including C++14) instead of having to
define it twice in C++23 mode (once as a static local variable and again
as a variable template for sake of constexpr evaluation).

libstdc++-v3/ChangeLog:

* include/std/charconv (__detail::__from_chars_alnum_to_val_table):
Redefine as a class template containing the members type, value and
_S_make_table.  Don't use a local class as the table type.
(__detail::__table): Remove.
(__detail::__from_chars_alnum_to_val): Adjust after the above.
libstdc++-v3/include/std/charconv