Commit 4c03d08
committed
fix(reflexion): wrap field_ptr's NTTP to avoid Clang's P1907R1 gate
Passing a bare pointer-to-subobject directly as a non-type template
argument needs P1907R1 ("generalized non-type template arguments"), an
experimental C++20 extension GCC has accepted since GCC 11 but Clang only
since Clang 18 (2024) - confirmed failing on this project's macOS
wheel-building CI, which ships Clang 15. Giving the probe object a real
definition (previous commit) didn't help: the gap is the NTTP kind itself,
not whether the referenced object is defined.
Wrapping the pointer in a one-member aggregate and letting CTAD deduce
that as the template argument sidesteps it entirely - a class-type
template argument built from a pointer member falls under P0732 ("class
types as non-type template parameters"), a much older, widely-supported
C++20 feature Clang has accepted for years. This is the same workaround
Boost.PFR uses for its own C++20 field-name reflection
(boost::pfr::detail::clang_wrapper_t), which documents the identical
Clang<=16 limitation.
Verified against the existing field_name test suite under both GCC 14 and
Clang 19 locally, and confirmed the new code compiles cleanly under
-pedantic-errors (no extension-usage diagnostics), consistent with no
longer depending on the experimental extension. Cannot verify directly
against Clang 15 itself - no such toolchain available here; this needs
confirming on the actual CI run.1 parent d376beb commit 4c03d08
1 file changed
Lines changed: 25 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
64 | | - | |
| 64 | + | |
65 | 65 | | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
| 66 | + | |
| 67 | + | |
71 | 68 | | |
72 | 69 | | |
73 | 70 | | |
74 | 71 | | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
75 | 93 | | |
76 | 94 | | |
77 | 95 | | |
78 | | - | |
| 96 | + | |
79 | 97 | | |
80 | 98 | | |
81 | 99 | | |
| |||
0 commit comments