boost::u32regex does not compile on latest libc++ (19.0) due to use of UChar32 / int32_t as charT
- Dominant language
- C++
- Stars
- 119
- Forks
- 113
- PR merge metrics
- No merged PRs in 30d
Description
This source
```c++
#include
#include
int main()
{
boost::u32regex re(boost::make_u32regex(R"(All.*)"));
auto pattern = re.str(); // fails
return 0;
}
```
when built with `clang++ -I /opt/homebrew/include -I /opt/homebrew/opt/icu4c/include -std=c++17 test.cpp -o test`
fails with
```
In file included from test.cpp:1:
In file included from /opt/homebrew/include/boost/regex.hpp:34:
In file included from /opt/homebrew/include/boost/regex/v5/regex.hpp:29:
In file included from /opt/homebrew/include/boost/regex/v5/regex_workaround.hpp:29:
In file included from /opt/homebrew/include/boost/throw_exception.hpp:21:
In file included from /opt/homebrew/include/boost/exception/exception.hpp:9:
In file included from /opt/homebrew/include/boost/assert/source_location.hpp:13:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/string:821:42: error: implicit instantiation of undefined template 'std::char_traits'
821 | static_assert(is_same<_CharT, typename traits_type::char_type>::value,
| ^
test.cpp:7:20: note: in instantiation of template class 'std::basic_string' requested here
7 | auto pattern = re.str(); // may fail
| ^
```
on latest AppleClang 17.0.0.17000013.
According to [MS STL issue #4935](https://github.com/microsoft/STL/issues/4935), libc++ 19.0 has restricted instantiations for `std::char_traits` to the standard character types `char`, `wchar_t`, `char8_t`, `char16_t`, `char32_t`, which lets `boost::u32regex::str()` fail here:
```c++
std::basic_string str()const
{
return m_pimpl.get() ? m_pimpl->str() : std::basic_string();
}
```
Tested with boost v1.87 and ICU 77 in Xcode 16.3 / AppleClang 17.0.0
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the boost/regex.hpp and boost/regex/icu.hpp entry points and reproduce the supplied C++17 build using AppleClang and libc++ 19. Trace boost::u32regex::str() and its std::basic_string instantiation; done means the example compiles and re.str() works with the reported Boost and ICU versions.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100