Skip to content

no internal linkage in headers#687

Open
autoantwort wants to merge 1 commit into
getml:mainfrom
autoantwort:feature/fix-usage-with-modules
Open

no internal linkage in headers#687
autoantwort wants to merge 1 commit into
getml:mainfrom
autoantwort:feature/fix-usage-with-modules

Conversation

@autoantwort

Copy link
Copy Markdown
Contributor

If I want to export an struct that has a rfl::Field, this template references the changed function and therefore tries to reference a TU-local entity which is illegal.

Details

The stacktrace from gcc:
In file included from /root/.vs/src2/out/build/x64-debug-linux/vcpkg_installed/x64-linux/include/rfl/Literal.hpp:14,
                 from /root/.vs/src2/out/build/x64-debug-linux/vcpkg_installed/x64-linux/include/rfl/Field.hpp:8,
                 from /root/.vs/src2/out/build/x64-debug-linux/vcpkg_installed/x64-linux/include/rfl/AddStructName.hpp:6,
                 from /root/.vs/src2/out/build/x64-debug-linux/vcpkg_installed/x64-linux/include/rfl.hpp:10,
                 from /root/.vs/src2/*****/lib/pdaLib/TestVariable.ixx:3:
/root/.vs/src2/out/build/x64-debug-linux/vcpkg_installed/x64-linux/include/rfl/Tuple.hpp:229:7: error: 'using rfl::tuple_element_t = typename rfl::tuple_element<ix, typename std::remove_cvref<_Tp2>::type>::type' exposes TU-local entity 'struct rfl::tuple_element<ix, typename std::remove_cvref<_Tp2>::type>'
  229 | using tuple_element_t =
      |       ^~~~~~~~~~~~~~~
/root/.vs/src2/out/build/x64-debug-linux/vcpkg_installed/x64-linux/include/rfl/Tuple.hpp:216:8: note: 'struct rfl::tuple_element<ix, typename std::remove_cvref<_Tp2>::type>' refers to TU-local object 'ix'
  216 | struct tuple_element;
      |        ^~~~~~~~~~~~~
In file included from /root/.vs/src2/out/build/x64-debug-linux/vcpkg_installed/x64-linux/include/rfl/Literal.hpp:16:
/root/.vs/src2/out/build/x64-debug-linux/vcpkg_installed/x64-linux/include/rfl/internal/find_index.hpp:40:17: note: 'ix' has no linkage and is declared within TU-local entity 'constexpr int rfl::internal::find_index()'
   40 |   constexpr int ix = wrap_fields<_field_name, Fields>(
      |                 ^~
/root/.vs/src2/out/build/x64-debug-linux/vcpkg_installed/x64-linux/include/rfl/internal/find_index.hpp:39:22: note: 'constexpr int rfl::internal::find_index()' declared with internal linkage
   39 | constexpr static int find_index() {
      |                      ^~~~~~~~~~
/root/.vs/src2/out/build/x64-debug-linux/vcpkg_installed/x64-linux/include/rfl/Tuple.hpp:229:7: error: 'using rfl::tuple_element_t = typename rfl::tuple_element<ix, typename std::remove_cvref<_Tp2>::type>::type' exposes TU-local entity 'struct rfl::tuple_element<ix, typename std::remove_cvref<_Tp2>::type>'
  229 | using tuple_element_t =
      |       ^~~~~~~~~~~~~~~
/root/.vs/src2/out/build/x64-debug-linux/vcpkg_installed/x64-linux/include/rfl/Tuple.hpp:216:8: note: 'struct rfl::tuple_element<ix, typename std::remove_cvref<_Tp2>::type>' refers to TU-local object 'ix'
  216 | struct tuple_element;
      |        ^~~~~~~~~~~~~
/root/.vs/src2/out/build/x64-debug-linux/vcpkg_installed/x64-linux/include/rfl/internal/find_index.hpp:53:19: note: 'ix' has no linkage and is declared within TU-local entity 'constexpr int rfl::internal::find_index_or_minus_one()'
   53 |     constexpr int ix = wrap_fields<_field_name, Fields>(
      |                   ^~
/root/.vs/src2/out/build/x64-debug-linux/vcpkg_installed/x64-linux/include/rfl/internal/find_index.hpp:49:22: note: 'constexpr int rfl::internal::find_index_or_minus_one()' declared with internal linkage
   49 | constexpr static int find_index_or_minus_one() {
      |                      ^~~~~~~~~~~~~~~~~~~~~~~

If I want to export an struct that has a rfl::Field, this template references the changed function and therefore tries to reference a TU-local entity which is illegal.

The stacktrace from gcc:
In file included from /root/.vs/src2/out/build/x64-debug-linux/vcpkg_installed/x64-linux/include/rfl/Literal.hpp:14,
                 from /root/.vs/src2/out/build/x64-debug-linux/vcpkg_installed/x64-linux/include/rfl/Field.hpp:8,
                 from /root/.vs/src2/out/build/x64-debug-linux/vcpkg_installed/x64-linux/include/rfl/AddStructName.hpp:6,
                 from /root/.vs/src2/out/build/x64-debug-linux/vcpkg_installed/x64-linux/include/rfl.hpp:10,
                 from /root/.vs/src2/*****/lib/pdaLib/TestVariable.ixx:3:
/root/.vs/src2/out/build/x64-debug-linux/vcpkg_installed/x64-linux/include/rfl/Tuple.hpp:229:7: error: 'using rfl::tuple_element_t = typename rfl::tuple_element<ix, typename std::remove_cvref<_Tp2>::type>::type' exposes TU-local entity 'struct rfl::tuple_element<ix, typename std::remove_cvref<_Tp2>::type>'
  229 | using tuple_element_t =
      |       ^~~~~~~~~~~~~~~
/root/.vs/src2/out/build/x64-debug-linux/vcpkg_installed/x64-linux/include/rfl/Tuple.hpp:216:8: note: 'struct rfl::tuple_element<ix, typename std::remove_cvref<_Tp2>::type>' refers to TU-local object 'ix'
  216 | struct tuple_element;
      |        ^~~~~~~~~~~~~
In file included from /root/.vs/src2/out/build/x64-debug-linux/vcpkg_installed/x64-linux/include/rfl/Literal.hpp:16:
/root/.vs/src2/out/build/x64-debug-linux/vcpkg_installed/x64-linux/include/rfl/internal/find_index.hpp:40:17: note: 'ix' has no linkage and is declared within TU-local entity 'constexpr int rfl::internal::find_index()'
   40 |   constexpr int ix = wrap_fields<_field_name, Fields>(
      |                 ^~
/root/.vs/src2/out/build/x64-debug-linux/vcpkg_installed/x64-linux/include/rfl/internal/find_index.hpp:39:22: note: 'constexpr int rfl::internal::find_index()' declared with internal linkage
   39 | constexpr static int find_index() {
      |                      ^~~~~~~~~~
/root/.vs/src2/out/build/x64-debug-linux/vcpkg_installed/x64-linux/include/rfl/Tuple.hpp:229:7: error: 'using rfl::tuple_element_t = typename rfl::tuple_element<ix, typename std::remove_cvref<_Tp2>::type>::type' exposes TU-local entity 'struct rfl::tuple_element<ix, typename std::remove_cvref<_Tp2>::type>'
  229 | using tuple_element_t =
      |       ^~~~~~~~~~~~~~~
/root/.vs/src2/out/build/x64-debug-linux/vcpkg_installed/x64-linux/include/rfl/Tuple.hpp:216:8: note: 'struct rfl::tuple_element<ix, typename std::remove_cvref<_Tp2>::type>' refers to TU-local object 'ix'
  216 | struct tuple_element;
      |        ^~~~~~~~~~~~~
/root/.vs/src2/out/build/x64-debug-linux/vcpkg_installed/x64-linux/include/rfl/internal/find_index.hpp:53:19: note: 'ix' has no linkage and is declared within TU-local entity 'constexpr int rfl::internal::find_index_or_minus_one()'
   53 |     constexpr int ix = wrap_fields<_field_name, Fields>(
      |                   ^~
/root/.vs/src2/out/build/x64-debug-linux/vcpkg_installed/x64-linux/include/rfl/internal/find_index.hpp:49:22: note: 'constexpr int rfl::internal::find_index_or_minus_one()' declared with internal linkage
   49 | constexpr static int find_index_or_minus_one() {
      |                      ^~~~~~~~~~~~~~~~~~~~~~~

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request removes the redundant static keyword from the constexpr function templates find_index and find_index_or_minus_one in include/rfl/internal/find_index.hpp. There are no review comments, and I have no feedback to provide.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

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.

1 participant