Skip to content

Boost.Regex/ICU will no longer compile with clang 19 #202

@pkl97

Description

@pkl97

This simple test program triggers a warning in clang 18 that indicates that the code will no longer compile with clang 19:

#include <iostream>
#include <boost/regex/icu.hpp>

int main()
{
    const boost::u32regex r1(boost::make_u32regex(".*"));
    const boost::u32regex r2(boost::make_u32regex(".*"));

    std::cout << "identical: " << (r1==r2?"yes":"no") << std::endl;
    return 0;
}

In file included from main.cpp:1:
In file included from include/c++/v1/iostream:43:
In file included from include/c++/v1/ios:221:
In file included from include/c++/v1/__fwd/ios.h:13:
include/c++/v1/__fwd/string.h:45:41: warning: 'char_traits' is deprecated: char_traits for T not equal to char, wchar_t, char8_t, char16_t or char32_t is non-standard and is provided for a temporary period. It will be removed in LLVM 19, so please migrate off of it. [-Wdeprecated-declarations]
45 | template <class _CharT, class _Traits = char_traits<_CharT>, class _Allocator = allocator<_CharT> >
| ^
Boost/1.83.0/include/boost/regex/v5/basic_regex.hpp:237:24: note: in instantiation of default argument for 'basic_string' required here
237 | result = std::basic_string(this->m_expression, this->m_expression_len);
| ^~~~~~~~~~~~~~~~~~~
Boost/1.83.0/include/boost/regex/v5/basic_regex.hpp:466:39: note: in instantiation of member function 'boost::re_detail_500::basic_regex_implementation<int, boost::icu_regex_traits>::str' requested here
466 | return m_pimpl.get() ? m_pimpl->str() : std::basic_string();
| ^
Boost/1.83.0/include/boost/regex/v5/basic_regex.hpp:536:14: note: in instantiation of member function 'boost::basic_regex<int, boost::icu_regex_traits>::str' requested here
536 | return str().compare(that.str());
| ^
Boost/1.83.0/include/boost/regex/v5/basic_regex.hpp:540:14: note: in instantiation of member function 'boost::basic_regex<int, boost::icu_regex_traits>::compare' requested here
540 | return compare(e) == 0;
| ^
main.cpp:9:38: note: in instantiation of member function 'boost::basic_regex<int, boost::icu_regex_traits>::operator==' requested here

The problem seems to be the character type UChar32 (which is actually int32_t) when Boost.Regex 1.83.0 is used in combination with the ICU library.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions