Commit 1701d6c
Fix sstream_convert for types not constructible from const char*
The sstream_convert template constructed the destination type via
To to(ss.str().c_str()), which only works when To accepts a
const char* (e.g. mpf_class). Instantiations with To = double, used
in tests/unit/test-core-ints.cc, fail to compile under gcc 16.
Dispatch via SFINAE: keep the c_str() construction for types that
accept const char*, and use stream extraction (To to; ss >> to;) for
all others.
Fixes #417
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>1 parent 4ca6f1c commit 1701d6c
1 file changed
Lines changed: 17 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
198 | 198 | | |
199 | 199 | | |
200 | 200 | | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
201 | 217 | | |
202 | 218 | | |
203 | 219 | | |
204 | 220 | | |
205 | 221 | | |
206 | 222 | | |
207 | 223 | | |
208 | | - | |
209 | | - | |
| 224 | + | |
210 | 225 | | |
211 | 226 | | |
212 | 227 | | |
| |||
0 commit comments