-
-
Notifications
You must be signed in to change notification settings - Fork 21
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
Update C++ Standard to C++17 #100
Conversation
Thanks @andrjohns! I've tagged @bgoodri to review since this is more in his wheelhouse than mine. |
Can we run the upstream unit tests under the C++-17 standard once?
|
Which unit tests do you mean sorry? |
I meant all of them in Stan Math and Stan Library but with -std=c++-17 in
the makefile.
|
@andrjohns Also, at this point we should make you a coauthor on this package instead of just a contributor. Feel free to change Also feel free to make branches directly in the repo in the future (if you want). I think you should have permission but if not let me know. |
And the upstream tests with recent Stan & Math were also run under c++-17 as part of this PR |
@bgoodri Does this change look ok to you? If so I can start preparing the CRAN submission. On the forum @andrjohns said he ran reverse dependency checks and all packages passed. Not sure if you saw this, but the reason for the approach @andrjohns took is related to this post from user @ edm on the forum (I think username @ecmerkle on GitHub):
|
Dear all, is there any progress on this? I'm holding back a necessary update to a package that depends on rstan and rstantools because of the aforementioned CRAN note. |
I concur in that this PR should move ahead ASAP, since all downstream packages really need this upgrade. I just had to workaround things in an ugly way...see here https://github.com/weberse2/RBesT/blob/1bb60a01f37cdcc613d752a438f16d4f19b5760d/configure To me it appears that CRAN is now happy with C++17 being used as a new default C++ standard. I have verified with a docker image (rhub/clang16) that the fix which is implemented in this PR is indeed what resolves the issues with clang 16 (this extra define thing). However, when reading the CRAN instructions for package maintainers carefully, they also say that it is strongly recommended to add C++17 to the SystemRequirements field of the DESCRIPTION file whenever C++17 is used (in addition to the src/Makevars). I am not sure if this is a hard check on their end on this, but their manuals imply that one should have this. Maybe even that could be automated with rstantools (that is to add C++17 automatically if no C++ standard has been set)? Or we just leave this. In any case... this PR would be great to roll out soon. However, making C++17 the default could be a challenge for some packages which use functions like "size" as I recall. These have compile issues with C++17. Not sure what to do about this other than finally moving to 2.26 where the C++17 back ports have been incorporated as I understood from @andrjohns . BTW... when building |
This isn't an issue for
I believe this has been addressed by adding |
Let's see, maybe Dirk can handle the matter with C++17 upstream in |
As discussed over on the forums, CRAN has begun issuing a
NOTE
when the requested C++ standard is lower than C++17. This PR updates the rstantools-provided Makevars to request the higher standard.I've run reverse-dependency checks and all packages continue to build and pass. This will break the current
rstan
2.26, but I've already opened a PR with the needed patches here