Don't use deprecated form of user-defined literal operator (#408)

* Don't use deprecated form of user-defined literal operator
* add clang warning regarding deprecated literal operator

---------

Co-authored-by: Hans Dembinski <hans.dembinski@gmail.com>
This commit is contained in:
Thomas-Barbier-1A
2025-06-05 16:54:54 +02:00
committed by GitHub
parent b5cce2833b
commit c55b5290af
3 changed files with 5 additions and 3 deletions

View File

@@ -85,4 +85,7 @@ jobs:
- name: Test cxxstd=17 ubsan asan
run: |
cd libs/histogram
../../b2 $B2_OPTS toolset=clang cxxstd=17 variant=histogram_ubasan test//all
# workaround: -Wdeprecated-literal-operator only works with clang and not with appleclang
# Apparently, build.jam cannot make the distinction, so we have to specify it here
../../b2 $B2_OPTS toolset=clang cxxstd=17 cxxflags="-Wdeprecated-literal-operator" variant=histogram_ubasan test//all

View File

@@ -22,7 +22,6 @@ constant boost_dependencies :
project /boost/histogram
: requirements
<toolset>clang:<cxxflags>"-Wsign-compare -Wstrict-aliasing -fstrict-aliasing -Wvexing-parse -Wfloat-conversion"
<toolset>darwin:<cxxflags>"-Wsign-compare -Wstrict-aliasing -fstrict-aliasing -Wvexing-parse -Wfloat-conversion"
<toolset>gcc:<cxxflags>"-Wsign-compare -Wstrict-aliasing -fstrict-aliasing -Wfloat-conversion"
<toolset>msvc:<cxxflags>"/bigobj"
<toolset>intel-win:<cxxflags>"/bigobj"

View File

@@ -23,7 +23,7 @@ constexpr unsigned parse_number(unsigned n, char f, Rest... rest) {
namespace literals {
/// Suffix operator to generate literal compile-time numbers, 0_c, 12_c, etc.
template <char... digits>
auto operator"" _c() {
auto operator ""_c() {
return std::integral_constant<unsigned, detail::parse_number(0, digits...)>();
}
} // namespace literals