Compilation failure with Clang SNAPSHOT #33539

issue hebasto opened this issue on October 4, 2025
  1. hebasto commented at 9:54 AM on October 4, 2025: member
    $ clang++ --version
    Ubuntu clang version 22.0.0 (++20251003081846+36dc2a941f53-1~exp1~20251003202013.1205)
    Target: x86_64-pc-linux-gnu
    Thread model: posix
    InstalledDir: /usr/lib/llvm-22/bin
    $ cmake --build build -j 1
    [4/447] Building CXX object src/CMakeFiles/bitcoin_node.dir/mapport.cpp.o
    FAILED: src/CMakeFiles/bitcoin_node.dir/mapport.cpp.o 
    /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 
    ../src/mapport.cpp:115:59: error: no matching member function for call to 'randrange'
      115 |         sleep_time = sleep_time_min + FastRandomContext().randrange<std::chrono::milliseconds>(sleep_time_max - sleep_time_min);
          |                                       ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ../src/random.h:254:7: note: candidate template ignored: constraints not satisfied [with I = std::chrono::milliseconds]
      254 |     I randrange(I range) noexcept
          |       ^
    ../src/random.h:253:14: note: because 'std::chrono::milliseconds' (aka 'duration<long, ratio<1, 1000>>') does not satisfy 'integral'
      253 |     template<std::integral I>
          |              ^
    /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
      107 |     concept integral = is_integral_v<_Tp>;
          |                        ^
    ../src/random.h:346:9: note: candidate template ignored: constraints not satisfied [with Dur = std::chrono::milliseconds]
      346 |     Dur randrange(std::common_type_t<Dur> range) noexcept
          |         ^
    ../src/random.h:345:15: note: because 'std::chrono::milliseconds' (aka 'duration<long, ratio<1, 1000>>') does not satisfy 'StdChronoDuration'
      345 |     template <StdChronoDuration Dur>
          |               ^
    ../src/random.h:157:5: note: because '[]<class Rep, class Period>(std::type_identity<std::chrono::duration<Rep, Period>>) {
    }(std::type_identity<T>())' would be invalid: no matching function for call to object of type '(lambda at ../src/random.h:157:5)'
      157 |     []<class Rep, class Period>(std::type_identity<std::chrono::duration<Rep, Period>>){}(
          |     ^
    1 error generated.
    ninja: 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:

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

    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
  9. maflcko commented at 7:01 AM on October 13, 2025: member
  10. hebasto commented at 10:32 AM on October 16, 2025: member
Contributors
Labels

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: 2026-04-17 00:12 UTC

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