clang-19 build fix: workaround narrowing-const-reference error#39249
clang-19 build fix: workaround narrowing-const-reference error#39249paparodeo wants to merge 1 commit intosagemath:developfrom paparodeo:narrowing
Conversation
```
In file included from build/cythonized/sage/graphs/base/boost_graph.cpp:1278:
build/cythonized/sage/graphs/base/boost_interface.cpp:119:34: error: non-constant-expression cannot be narrowed from type 'value_type' (aka 'unsigned long') to 'int' in initializer list [-Wc++11-narrowing-const-reference]
119 | to_return.push_back({index[boost::source(*ei, graph)],
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
build/cythonized/sage/graphs/base/boost_graph.cpp:17503:29: note: in instantiation of member function 'BoostGraph<boost::vecS, boost::vecS, boost::directedS, boost::vecS, boost::property<boost::edge_weight_t, double>>::edge_list' requested here
17503 | __pyx_v_edges = __pyx_v_g.edge_list();
^
```
https://clang.llvm.org/docs/DiagnosticsReference.html#wc-11-narrowing-const-reference
To silence the error assign to a v_index outside of the
initializer list.
|
Documentation preview for this PR (built with commit 216f91c; changes) is ready! 🎉 |
|
@paparodeo why did you close this PR? Is this not an actual issue that should be fixed? (Got the same problem on conda-forge when building for macOS.) |
it is still an issue -- the PR closed when I deleted the repository. the PR was open for a month with no response. |
|
I'm actually a bit puzzled that this fixes the warning. It seems that the following line contains another such narrowing. Was that the only warning that showed up for you @paparodeo ? |
|
This looks quite wrong:
|
the change in this PR fixed the build -- it is an error not a warning. |
this fixes an underlying type confusion in our wrapper that has lead to warnings before but now produces an actual error, see sagemath#39249
sagemathgh-39526: Fix compile error when compiling boost graphs with recent clang this fixes an underlying type confusion in our wrapper that has lead to warnings before but now produces an actual error, see sagemath#39249 URL: sagemath#39526 Reported by: Julian Rüth Reviewer(s): Dima Pasechnik, Julian Rüth, user202729
sagemathgh-39526: Fix compile error when compiling boost graphs with recent clang this fixes an underlying type confusion in our wrapper that has lead to warnings before but now produces an actual error, see sagemath#39249 URL: sagemath#39526 Reported by: Julian Rüth Reviewer(s): Dima Pasechnik, Julian Rüth, user202729
sagemathgh-39526: Fix compile error when compiling boost graphs with recent clang this fixes an underlying type confusion in our wrapper that has lead to warnings before but now produces an actual error, see sagemath#39249 URL: sagemath#39526 Reported by: Julian Rüth Reviewer(s): Dima Pasechnik, Julian Rüth, user202729
sagemathgh-39526: Fix compile error when compiling boost graphs with recent clang this fixes an underlying type confusion in our wrapper that has lead to warnings before but now produces an actual error, see sagemath#39249 URL: sagemath#39526 Reported by: Julian Rüth Reviewer(s): Dima Pasechnik, Isuru Fernando, Julian Rüth, user202729
sagemathgh-39526: Fix compile error when compiling boost graphs with recent clang this fixes an underlying type confusion in our wrapper that has lead to warnings before but now produces an actual error, see sagemath#39249 URL: sagemath#39526 Reported by: Julian Rüth Reviewer(s): Dima Pasechnik, Isuru Fernando, Julian Rüth, user202729
sagemathgh-39189: Add support for Python 3.13 in conda <!-- ^ Please provide a concise and informative title. --> <!-- ^ Don't put issue numbers in the title, do this in the PR description below. --> <!-- ^ For example, instead of "Fixes sagemath#12345" use "Introduce new method to calculate 1 + 2". --> <!-- v Describe your changes below in detail. --> <!-- v Why is this change required? What problem does it solve? --> <!-- v If this PR resolves an open issue, please link to it here. For example, "Fixes sagemath#12345". --> Fixes sagemath#39163 ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> - [x] The title is concise and informative. - [ ] The description explains in detail what this PR is about. - [x] I have linked a relevant issue or discussion. - [ ] I have created tests covering the changes. - [ ] I have updated the documentation and checked the documentation preview. ### ⌛ Dependencies - sagemath#38749 - sagemath#39249 <!-- List all open PRs that this PR logically depends on. For example, --> <!-- - sagemath#12345: short description why this is a dependency --> <!-- - sagemath#34567: ... --> URL: sagemath#39189 Reported by: Tobias Diez Reviewer(s): Dima Pasechnik
sagemathgh-39189: Add support for Python 3.13 in conda <!-- ^ Please provide a concise and informative title. --> <!-- ^ Don't put issue numbers in the title, do this in the PR description below. --> <!-- ^ For example, instead of "Fixes sagemath#12345" use "Introduce new method to calculate 1 + 2". --> <!-- v Describe your changes below in detail. --> <!-- v Why is this change required? What problem does it solve? --> <!-- v If this PR resolves an open issue, please link to it here. For example, "Fixes sagemath#12345". --> Fixes sagemath#39163 ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> - [x] The title is concise and informative. - [ ] The description explains in detail what this PR is about. - [x] I have linked a relevant issue or discussion. - [ ] I have created tests covering the changes. - [ ] I have updated the documentation and checked the documentation preview. ### ⌛ Dependencies - sagemath#38749 - sagemath#39249 <!-- List all open PRs that this PR logically depends on. For example, --> <!-- - sagemath#12345: short description why this is a dependency --> <!-- - sagemath#34567: ... --> URL: sagemath#39189 Reported by: Tobias Diez Reviewer(s): Dima Pasechnik
sagemathgh-39189: Add support for Python 3.13 in conda <!-- ^ Please provide a concise and informative title. --> <!-- ^ Don't put issue numbers in the title, do this in the PR description below. --> <!-- ^ For example, instead of "Fixes sagemath#12345" use "Introduce new method to calculate 1 + 2". --> <!-- v Describe your changes below in detail. --> <!-- v Why is this change required? What problem does it solve? --> <!-- v If this PR resolves an open issue, please link to it here. For example, "Fixes sagemath#12345". --> Fixes sagemath#39163 ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> - [x] The title is concise and informative. - [ ] The description explains in detail what this PR is about. - [x] I have linked a relevant issue or discussion. - [ ] I have created tests covering the changes. - [ ] I have updated the documentation and checked the documentation preview. ### ⌛ Dependencies - sagemath#38749 - sagemath#39249 <!-- List all open PRs that this PR logically depends on. For example, --> <!-- - sagemath#12345: short description why this is a dependency --> <!-- - sagemath#34567: ... --> URL: sagemath#39189 Reported by: Tobias Diez Reviewer(s): Dima Pasechnik
while building sage 10.5 with clang-19 with nixpkgs on macOS the build fails with the following error:
https://clang.llvm.org/docs/DiagnosticsReference.html#wc-11-narrowing-const-reference
To silence the error assign to a v_index outside of the initializer list.
📝 Checklist
⌛ Dependencies