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

[C++] Remove superfluous static constexpr definitions #43054

Closed
wants to merge 2 commits into from

Conversation

pitrou
Copy link
Member

@pitrou pitrou commented Jun 26, 2024

Since C++17, static constexpr members are automatically considered inline.

Rationale for this change

What changes are included in this PR?

Are these changes tested?

Are there any user-facing changes?

Copy link

Thanks for opening a pull request!

If this is not a minor PR. Could you open an issue for this pull request on GitHub? https://github.com/apache/arrow/issues/new/choose

Opening GitHub issues ahead of time contributes to the Openness of the Apache Arrow project.

Then could you also rename the pull request title in the following format?

GH-${GITHUB_ISSUE_ID}: [${COMPONENT}] ${SUMMARY}

or

MINOR: [${COMPONENT}] ${SUMMARY}

In the case of PARQUET issues on JIRA the title also supports:

PARQUET-${JIRA_ISSUE_ID}: [${COMPONENT}] ${SUMMARY}

See also:

@pitrou
Copy link
Member Author

pitrou commented Jun 26, 2024

This will probably fail on MinGW (as fixed elsewhere by 3ec3939), but let's try anyway. @felipecrv

@pitrou
Copy link
Member Author

pitrou commented Jun 26, 2024

Weirdly, MinGW seems to pass, but we should try again after #42236 is merged (perhaps a type_id member reference in a test makes it fail?).

Since C++17, static constexpr members are automatically considered inline.
@pitrou
Copy link
Member Author

pitrou commented Jun 26, 2024

I rebased with #42236 now merged, let's see what entails.

@pitrou
Copy link
Member Author

pitrou commented Jun 26, 2024

... and indeed MINGW fails.

@pitrou
Copy link
Member Author

pitrou commented Jun 26, 2024

Ok, it seems that even an explicit inline qualifier doesn't help. This seems to be a bug in the MINGW64 port of gcc, so we'll have to live with it until we upgrade or demote that compiler in CI. @kou

@pitrou
Copy link
Member Author

pitrou commented Jun 26, 2024

For reference, the linker error:

D:/a/_temp/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: src/arrow/compute/kernels/CMakeFiles/arrow-compute-vector-test.dir/vector_nested_test.cc.obj:vector_nested_test.cc:(.text$_ZN5arrow7compute12SwapListViewINS_12ListViewTypeEiEEvPNS_9ArrayDataExx[_ZN5arrow7compute12SwapListViewINS_12ListViewTypeEiEEvPNS_9ArrayDataExx]+0x117): undefined reference to `__imp__ZN5arrow12ListViewType7type_idE'
D:/a/_temp/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: src/arrow/compute/kernels/CMakeFiles/arrow-compute-vector-test.dir/vector_nested_test.cc.obj:vector_nested_test.cc:(.text$_ZN5arrow7compute11SetListViewINS_12ListViewTypeEiEEvPNS_9ArrayDataExT0_S5_[_ZN5arrow7compute11SetListViewINS_12ListViewTypeEiEEvPNS_9ArrayDataExT0_S5_]+0x12f): undefined reference to `__imp__ZN5arrow12ListViewType7type_idE'

Some special handling is probably required for static inline members of dllexport classes. CLang handles them properly, but gcc doesn't, apparently.

@pitrou pitrou closed this Jun 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant