Skip to content

Compilation failure with Clang SNAPSHOT #33539

Closed

Description

@hebasto
$ 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.

Activity

  1. hebasto commented on Oct 4, 2025

    @hebasto
    MemberAuthor

    cc @sipa as the code author.

  2. sipa commented on Oct 4, 2025

    @sipa
    Member

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

  3. hebasto commented on Oct 4, 2025

    @hebasto
    MemberAuthor

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

    It does. No issues.

  4. sipa commented on Oct 4, 2025

    @sipa
    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?

  5. deleted a comment from MarcusMWilliams on Oct 4, 2025
  6. maflcko commented on Oct 13, 2025

    @maflcko
    Member
  7. locked and limited conversation to collaborators on Oct 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions