We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I
nameof version: 0.10.4
nameof
<complex.h> defines I as a shorthand for the imaginary constant $i$. This mangles the template argument I and causes compilation to fail.
<complex.h>
(Context is that I'm working with math libraries that transitively include <complex.h>.)
MWE:
#include <complex.h> #include <iostream> #include <nameof.hpp> class Minimal {}; int main() { Minimal mini{}; std::cout << NAMEOF_SHORT_TYPE_RTTI(mini) << '\n'; return 0; }
Remove the <complex.h> include and compilation succeeds.
Compiler nonsense (g++ 13.3.0):
In file included from /usr/include/c++/13/complex.h:38, from src/minimal.cpp:1: nameof.hpp:276:30: error: expected ‘>’ before ‘(’ token 276 | template <std::uint16_t... I> | ^ In file included from src/minimal.cpp:4: nameof.hpp:277:76: error: expansion pattern ‘(__complex__ float){0.0f, 1.0e+0f}’ contains no parameter packs 277 | constexpr cstring(string_view str, std::integer_sequence<std::uint16_t, I...>) noexcept : chars_{str[I]..., '\0'} {} | ^~~ nameof.hpp:277:79: error: template argument 2 is invalid 277 | constexpr cstring(string_view str, std::integer_sequence<std::uint16_t, I...>) noexcept : chars_{str[I]..., '\0'} {} | ^ nameof.hpp: In constructor ‘constexpr nameof::cstring<N>::cstring(std::string_view, int)’: nameof.hpp:277:103: error: no match for ‘operator[]’ (operand types are ‘std::string_view’ {aka ‘std::basic_string_view<char>’} and ‘__complex__ float’) 277 | constexpr cstring(string_view str, std::integer_sequence<std::uint16_t, I...>) noexcept : chars_{str[I]..., '\0'} {} | ^ In file included from /usr/include/c++/13/bits/basic_string.h:47, from /usr/include/c++/13/string:54, from /usr/include/c++/13/bits/locale_classes.h:40, from /usr/include/c++/13/bits/ios_base.h:41, from /usr/include/c++/13/ios:44, from /usr/include/c++/13/istream:40, from /usr/include/c++/13/sstream:40, from /usr/include/c++/13/complex:45, from /usr/include/c++/13/ccomplex:39, from /usr/include/c++/13/complex.h:32: /usr/include/c++/13/string_view:254:7: note: candidate: ‘constexpr const std::basic_string_view<_CharT, _Traits>::value_type& std::basic_string_view<_CharT, _Traits>::operator[](size_type) const [with _CharT = char; _Traits = std::char_traits<char>; const_reference = const char&; size_type = long unsigned int]’ 254 | operator[](size_type __pos) const noexcept | ^~~~~~~~ /usr/include/c++/13/string_view:254:28: note: no known conversion for argument 1 from ‘__complex__ float’ to ‘std::basic_string_view<char>::size_type’ {aka ‘long unsigned int’} 254 | operator[](size_type __pos) const noexcept | ~~~~~~~~~~^~~~~ nameof.hpp: At global scope: nameof.hpp:528:20: error: expected nested-name-specifier before ‘(’ token 528 | template <typename I> | ^ nameof.hpp:528:20: error: expected ‘)’ before ‘__extension__’ 528 | template <typename I> | ^ nameof.hpp:528:20: error: expected ‘>’ before ‘__extension__’ nameof.hpp:528:20: error: expected unqualified-id before ‘)’ token 528 | template <typename I> | ^ nameof.hpp:665:76: error: expected ‘)’ before ‘__extension__’ 665 | template <typename E, bool IsFlags, std::size_t Size, int Min, std::size_t I> | ^ nameof.hpp:665:76: error: expected ‘>’ before ‘__extension__’ nameof.hpp:665:76: error: expected unqualified-id before ‘)’ token 665 | template <typename E, bool IsFlags, std::size_t Size, int Min, std::size_t I> | ^ nameof.hpp:744:52: error: expected ‘>’ before ‘(’ token 744 | template <typename E, bool IsFlags, std::size_t... I> | ^ nameof.hpp:745:43: error: expansion pattern ‘(__complex__ float){0.0f, 1.0e+0f}’ contains no parameter packs 745 | constexpr auto names(std::index_sequence<I...>) noexcept { | ^~~ nameof.hpp:745:46: error: template argument 1 is invalid 745 | constexpr auto names(std::index_sequence<I...>) noexcept { | ^ nameof.hpp: In function ‘constexpr auto nameof::detail::names(int)’: nameof.hpp:746:60: error: template argument 2 is invalid 746 | constexpr auto names = std::array<string_view, sizeof...(I)>{{enum_name_v<E, values_v<E, IsFlags>[I]>...}}; |
The text was updated successfully, but these errors were encountered:
Neargye
No branches or pull requests
nameof
version: 0.10.4<complex.h>
definesI
as a shorthand for the imaginary constantI
and causes compilation to fail.(Context is that I'm working with math libraries that transitively include
<complex.h>
.)MWE:
Remove the
<complex.h>
include and compilation succeeds.Compiler nonsense (g++ 13.3.0):
The text was updated successfully, but these errors were encountered: