You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Undefined reference to index_tag<0ul> on clang 17 #54
/opt/compiler-explorer/gcc-13.2.0/lib/gcc/x86_64-linux-gnu/13.2.0/../../../../x86_64-linux-gnu/bin/ld: /tmp/example-480496.o:(.debug_addr+0x20): undefined reference to `void nonstd::variants::detail::index_tag<0ul>(nonstd::variants::detail::index_tag_t<0ul>)'
I compiled with clang 16 which works and compare the output of the object files from clang 17. The only different between the two is below
Clang-16 0000000000000000 W void nonstd::variants::detail::index_tag<0ul>(nonstd::variants::detail::index_tag_t<0ul>)
Clang-17 U void nonstd::variants::detail::index_tag<0ul>(nonstd::variants::detail::index_tag_t<0ul>)
Here is the PR that fixes the issue: #56
I simplified the non-type template parameter by replacing the reference (which unfortunately generates an undefined reference) to a function with a pointer. Another option would be to use conditional compilation and apply the pointer only for Clang, but that seems like unnecessary complication. I also fixed the tests that were failing with GCC and Clang.
@martinmoene could you please check the result of script/generate_header.py? It looks like the output it generates is out of sync with the current implementation in template/variant.hpp. I suspect there were changes made to include/nonstd/variant.hpp, but the template was not updated accordingly.
Activity
martinmoene commentedon Sep 20, 2025
Thanks @nikhilkalige for your report.
No idea yet how to tackle this.
geghamyan commentedon Sep 23, 2025
Here is the PR that fixes the issue: #56
I simplified the non-type template parameter by replacing the reference (which unfortunately generates an undefined reference) to a function with a pointer. Another option would be to use conditional compilation and apply the pointer only for Clang, but that seems like unnecessary complication. I also fixed the tests that were failing with GCC and Clang.
geghamyan commentedon Sep 23, 2025
@martinmoene could you please check the result of script/generate_header.py? It looks like the output it generates is out of sync with the current implementation in
template/variant.hpp. I suspect there were changes made toinclude/nonstd/variant.hpp, but the template was not updated accordingly.martinmoene commentedon Sep 23, 2025
Thanks for your help. Hope to look into it later today / tonight.
martinmoene commentedon Sep 23, 2025
@nikhilkalige There is indeed one commit that changes
include/nonstd/variant.hppinstead oftemplate/variant.hpp.Clearly I forgot about the update script :(
See also this remark at issue 55.
geghamyan commentedon Sep 23, 2025
Sounds good, thank you. Please let me know if you'd like me to make any updates to the PR. Thank you for supporting this project.
Add test case for "Undefined reference to index_tag<0ul>" on clang-17…
martinmoene commentedon Sep 28, 2025
Merged PR #56.