Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build fails with clang-18: non-constant-expression cannot be narrowed from type 'buffer::size_type' (aka 'long') to 'std::size_t' #5254

Open
yurivict opened this issue Dec 15, 2024 · 2 comments
Labels

Comments

@yurivict
Copy link

Describe the bug

In file included from /usr/ports/science/qmcpack/work/qmcpack-3.17.1/src/Message/MPIObjectBase.cpp:14:
In file included from /usr/ports/science/qmcpack/work/qmcpack-3.17.1/src/Message/MPIObjectBase.h:20:
In file included from /usr/ports/science/qmcpack/work/qmcpack-3.17.1/src/Message/Communicate.h:28:
In file included from /usr/ports/science/qmcpack/work/qmcpack-3.17.1/external_codes/mpi_wrapper/mpi3/include/mpi3/environment.hpp:9:
In file included from /usr/ports/science/qmcpack/work/qmcpack-3.17.1/external_codes/mpi_wrapper/mpi3/include/mpi3/./communicator.hpp:27:
/usr/ports/science/qmcpack/work/qmcpack-3.17.1/external_codes/mpi_wrapper/mpi3/include/mpi3/./../mpi3/detail/package.hpp:27:11: error: non-constant-expression cannot be narrowed from type 'buffer::size_type' (aka 'long') to 'std::size_t' (aka 'unsigned long') in initializer list [-Wc++11-narrowing]
   27 |         : buffer{n}, bcomm_{reinterpret_cast<basic_communicator&>(comm)} {  // NOLINT(cppcoreguidelines-pro-type-reinterpret-cast) TODO(correaa) break cyclic dependency of classes
      |                  ^
/usr/ports/science/qmcpack/work/qmcpack-3.17.1/external_codes/mpi_wrapper/mpi3/include/mpi3/./../mpi3/detail/package.hpp:27:11: note: insert an explicit cast to silence this issue
   27 |         : buffer{n}, bcomm_{reinterpret_cast<basic_communicator&>(comm)} {  // NOLINT(cppcoreguidelines-pro-type-reinterpret-cast) TODO(correaa) break cyclic dependency of classes
      |                  ^
      |                  static_cast<size_t>( )
1 error generated.

To Reproduce
build

Expected behavior
n/a

System:
FreeBSD 14.1
clang-18

Version: 3.17.1

@prckent
Copy link
Contributor

prckent commented Dec 15, 2024

Thanks for reporting Yuri. This is fixed on the develop branch; at least clang-19 is OK. We have a v4.0 release coming up soon. How useful would a backport be for you, and is there a deadline we should try to hit? We can discuss making a 3.17.2.

@yurivict
Copy link
Author

Hi Paul,

This isn't urgent. I will wait for the next release.

Thank you,
Yuri

@prckent prckent added the bug label Dec 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants