Compilation failure with Clang SNAPSHOT #33539

issue hebasto openend this issue on October 4, 2025
  1. hebasto commented at 9:54 am on October 4, 2025: member
     0$ clang++ --version
     1Ubuntu clang version 22.0.0 (++20251003081846+36dc2a941f53-1~exp1~20251003202013.1205)
     2Target: x86_64-pc-linux-gnu
     3Thread model: posix
     4InstalledDir: /usr/lib/llvm-22/bin
     5$ cmake --build build -j 1
     6[4/447] Building CXX object src/CMakeFiles/bitcoin_node.dir/mapport.cpp.o
     7FAILED: src/CMakeFiles/bitcoin_node.dir/mapport.cpp.o 
     8/usr/bin/ccache /usr/bin/clang++-22 -DBOOST_MULTI_INDEX_DISABLE_SERIALIZATION -DBOOST_NO_CXX98_FUNCTION_BASE -I/home/hebasto/dev/bitcoin/build/src -I/home/hebasto/dev/bitcoin/src -I/home/hebasto/dev/bitcoin/src/leveldb/include -I/home/hebasto/dev/bitcoin/src/minisketch/include -I/home/hebasto/dev/bitcoin/src/univalue/include -O2 -g -std=c++20 -fPIC -fdebug-prefix-map=/home/hebasto/dev/bitcoin/src=. -fmacro-prefix-map=/home/hebasto/dev/bitcoin/src=. -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -Wstack-protector -fstack-protector-all -fcf-protection=full -fstack-clash-protection -Wall -Wextra -Wgnu -Wformat -Wformat-security -Wvla -Wshadow-field -Wthread-safety -Wthread-safety-pointer -Wloop-analysis -Wredundant-decls -Wunused-member-function -Wdate-time -Wconditional-uninitialized -Woverloaded-virtual -Wsuggest-override -Wimplicit-fallthrough -Wunreachable-code -Wdocumentation -Wself-assign -Wundef -Wno-unused-parameter -MD -MT src/CMakeFiles/bitcoin_node.dir/mapport.cpp.o -MF src/CMakeFiles/bitcoin_node.dir/mapport.cpp.o.d -o src/CMakeFiles/bitcoin_node.dir/mapport.cpp.o -c /home/hebasto/dev/bitcoin/src/mapport.cpp 
     9../src/mapport.cpp:115:59: error: no matching member function for call to 'randrange'
    10  115 |         sleep_time = sleep_time_min + FastRandomContext().randrange<std::chrono::milliseconds>(sleep_time_max - sleep_time_min);
    11      |                                       ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    12../src/random.h:254:7: note: candidate template ignored: constraints not satisfied [with I = std::chrono::milliseconds]
    13  254 |     I randrange(I range) noexcept
    14      |       ^
    15../src/random.h:253:14: note: because 'std::chrono::milliseconds' (aka 'duration<long, ratio<1, 1000>>') does not satisfy 'integral'
    16  253 |     template<std::integral I>
    17      |              ^
    18/usr/lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/concepts:107:24: note: because 'is_integral_v<std::chrono::duration<long, std::ratio<1, 1000>>>' evaluated to false
    19  107 |     concept integral = is_integral_v<_Tp>;
    20      |                        ^
    21../src/random.h:346:9: note: candidate template ignored: constraints not satisfied [with Dur = std::chrono::milliseconds]
    22  346 |     Dur randrange(std::common_type_t<Dur> range) noexcept
    23      |         ^
    24../src/random.h:345:15: note: because 'std::chrono::milliseconds' (aka 'duration<long, ratio<1, 1000>>') does not satisfy 'StdChronoDuration'
    25  345 |     template <StdChronoDuration Dur>
    26      |               ^
    27../src/random.h:157:5: note: because '[]<class Rep, class Period>(std::type_identity<std::chrono::duration<Rep, Period>>) {
    28}(std::type_identity<T>())' would be invalid: no matching function for call to object of type '(lambda at ../src/random.h:157:5)'
    29  157 |     []<class Rep, class Period>(std::type_identity<std::chrono::duration<Rep, Period>>){}(
    30      |     ^
    311 error generated.
    32ninja: build stopped: subcommand failed.
    
  2. hebasto commented at 9:55 am on October 4, 2025: member
    cc @sipa as the code author.
  3. sipa commented at 1:16 pm on October 4, 2025: member
    I can’t reproduce this on godbolt. Does the code there work for you? https://godbolt.org/z/f7E4Y7rrb
  4. hebasto commented at 1:20 pm on October 4, 2025: member

    I can’t reproduce this on godbolt. Does the code there work for you? https://godbolt.org/z/f7E4Y7rrb

    It does. No issues.

  5. sipa commented at 1:25 pm on October 4, 2025: member

    That makes no sense!

    The warning above complains:

    0../src/random.h:345:15: note: because 'std::chrono::milliseconds' (aka 'duration<long, ratio<1, 1000>>') does not satisfy 'StdChronoDuration'
    1  345 |     template <StdChronoDuration Dur>
    2      |               ^
    

    And yet, the godbolt snippet invokes rand, which is templated as template <StdChronoDuration Dur> just the same, with std::chrono::milliseconds as argument.

    Compiler bug, which is hopefully resolved before they release?

  6. bitcoin deleted a comment on Oct 4, 2025
  7. fanquake closed this on Oct 4, 2025

  8. fanquake added the label Upstream on Oct 4, 2025


hebasto sipa

Labels
Upstream


github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2025-10-10 18:13 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me