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

Not compiling with clang19 #1130

Open
bgoodri opened this issue Jun 15, 2024 · 8 comments
Open

Not compiling with clang19 #1130

bgoodri opened this issue Jun 15, 2024 · 8 comments

Comments

@bgoodri
Copy link
Contributor

bgoodri commented Jun 15, 2024

Summary:

Models do not compile with clang19. @SteveBronder or @WardBrian do you know what this means?

Description:

From https://www.stats.ox.ac.uk/pub/bdr/clang19/AovBay.log , which like rstanarm depends on rstan, StanHeaders, etc.

In file included from stanExports_onewaymodel.cc:5:
In file included from ./stanExports_onewaymodel.h:25:
In file included from /data/gannet/ripley/R/test-clang/StanHeaders/include/src/stan/model/model_header.hpp:11:
/data/gannet/ripley/R/test-clang/StanHeaders/include/src/stan/model/model_base_crtp.hpp:140:50: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
  140 |     return static_cast<const M*>(this)->template write_array(
      |                                                  ^
/data/gannet/ripley/R/test-clang/StanHeaders/include/src/stan/model/model_base_crtp.hpp:209:50: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
  209 |     return static_cast<const M*>(this)->template write_array(
      |                                                  ^

Reproducible Steps:

Try to compile a model with clang19

Current Output:

None

Expected Output:

A compiled stanmodel object

RStan Version:

2.31.x

R Version:

4.4.x

Operating System:

Linux

@bob-carpenter
Copy link

From the error message, it looks like Clang 19 wants the empty template args <>, so it would look like this: (this)->template<> write_array(....

@WardBrian
Copy link
Member

Clang19 isn’t actually released yet, correct?

@WardBrian
Copy link
Member

I believe Bob is correct: llvm/llvm-project#80801

@andrjohns
Copy link
Contributor

Just in case it might help with CI - the RHub project has a variety of docker containers with setups including clang19

@bgoodri
Copy link
Contributor Author

bgoodri commented Jun 15, 2024

OK. Does the code need to test for clang version 19 or later or would making those lines be like Bob says be fine for other compilers too?

@WardBrian
Copy link
Member

When we open a PR to change model base our CI should tell us whether or not it’s a problem on older clang and GCC

@bob-carpenter
Copy link

We should just be able to update. The syntax with the explicit <> should work on earlier compilers. But as @WardBrian says, the proof is in the CI.

@WardBrian
Copy link
Member

Ah, upstream resolved this in stan-dev/stan#3228 (part of 2.34) by removing the template keyword in this case. I think adding the <> is equivalent, but removing the keyword seemed more direct

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

No branches or pull requests

4 participants