Skip to content

Conversation

@ribbon-otter
Copy link
Contributor

This is the pull request which solves this corresponding bug.

Note that while trying to test it, I was unable to run all of the tests, as the makefile to build the tests would fail with

../dlib/dnn/layers.h:2447:25: error: casting ‘dlib::alias_tensor_const_instance’ to ‘dlib::tensor&’ does not use 
‘dlib::alias_tensor_const_instance::operator const dlib::tensor&()’ [-Werror=cast-user-defined]
 2447 |             tt::gemm(1, (tensor&)sgi, 1, gi, false, w, true);
      |                         ^~~~~~~~~~~~

However, this would happen on master as well, so this isn't the fault of my patch.

@davisking davisking merged commit e93a0ef into davisking:master Aug 9, 2025
8 checks passed
@davisking
Copy link
Owner

Nice, thanks for the PR.

How did you hit that build error? All the tests build on all the test platforms. You trying to use literally the dlib/test/makefile file? I just realized that file doesn't set C++14 (everything really uses the CMakeLists.txt file, the makefile is there just for convenient hacking sometimes and as an example, but it's out of date. Fixing that...).

@ribbon-otter
Copy link
Contributor Author

I am using the cmake generated makefile. Some files compile but display the -Wcast-user-defined warning. A file later is apparently configured with -Werror=cast-user-defined and that causes an error when it is compiles. The easy "fix" would be to dig into the CMakeLists.txt files and disable the flag that sets Wcast-user-defined to be an error on just those later files.

Perhaps this is a compiler difference? Compilers do differ on what they warn about sometimes.

Perhaps the correct fix would be to change the offending line to which does explicitly call the user defined conversion function.

@davisking
Copy link
Owner

Yeah presumably it would not warn if that line used a static_cast instead (which is a better way to do it). Does switching to that make it not complain for you? You want to send a PR for that if so? :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants