Closed WardBrian closed 6 months ago
Here is a really minimal godbolt showing the issue in clang but not GCC:
https://godbolt.org/z/E48P35vbx
It seems like the issue began in Clang 7.0.0, earlier versions compiled it fine.
Merging #1382 (ec1d544) into master (02a3a85) will increase coverage by
0.00%
. Report is 3 commits behind head on master. The diff coverage is100.00%
.:exclamation: Current head ec1d544 differs from pull request most recent head 9622dea. Consider uploading reports for the commit 9622dea to get more accurate results
I found a similar issue for another library which may imply that this is something Eigen could fix: https://github.com/nlohmann/json/issues/2226
Still not clear why gcc is happier than clang about it
@SteveBronder and I spent a lot more time looking over it and we actually think clang may be correct (executing the gcc version in godbolt segfaults, but this version does not)
We also found some issues related to data and eigen::maps which were similar
First reported by @goedman here, there seems to be a clang-specific issue with passing temporaries like those produced by
stan::math::multiply
to the constructor ofstd::tuple
whenstd::tuple
is told it will be holding a constant reference.GCC seems fine with this, and @SteveBronder thinks the C++ spec allows it, but we work around it here by restricting the logic we used to mark a type in a tuple as constant reference to only simple expressions (e.g., variables)
Submission Checklist
Release notes
Fixed an issue with clang compilers and constructing tuples.
Copyright and Licensing
By submitting this pull request, the copyright holder is agreeing to license the submitted work under the BSD 3-clause license (https://opensource.org/licenses/BSD-3-Clause)