Skip to content

Fix ambiguous overloaded call on SPK::IO::Buffer#20

Open
kingscallop wants to merge 1 commit intoSynxis:spark2from
kingscallop:ambiguous-overloaded-call-fix
Open

Fix ambiguous overloaded call on SPK::IO::Buffer#20
kingscallop wants to merge 1 commit intoSynxis:spark2from
kingscallop:ambiguous-overloaded-call-fix

Conversation

@kingscallop
Copy link
Copy Markdown
Contributor

When trying to write a 'size_t' to a SPK::IO::Buffer, the following error happens.

spark/include/Core/IO/SPK_IO_Buffer.h:224:27: error: call of overloaded ‘put(long unsigned int&)’ is ambiguous
  224 |                 buffer.put(value);
      |                 ~~~~~~~~~~^~~~~~~
spark/include/Core/IO/SPK_IO_Buffer.h:76:22: note: candidate: ‘void SPK::IO::Buffer::put(char)’
   76 |                 void put(char c);
      |                      ^~~
spark/include/Core/IO/SPK_IO_Buffer.h:96:22: note: candidate: ‘void SPK::IO::Buffer::put(unsigned char)’
   96 |                 void put(unsigned char c)       { put((char)c); }
      |                      ^~~
spark/include/Core/IO/SPK_IO_Buffer.h:97:22: note: candidate: ‘void SPK::IO::Buffer::put(signed char)’
   97 |                 void put(signed char c)         { put((char)c); }


etc.

As there is no overload to 'size_t', the patch casts it to unsigned int.

When trying to write a 'size_t' to a SPK::IO::Buffer, the following error happens.

spark/include/Core/IO/SPK_IO_Buffer.h:224:27: error: call of overloaded ‘put(long unsigned int&)’ is ambiguous
  224 |                 buffer.put(value);
      |                 ~~~~~~~~~~^~~~~~~
spark/include/Core/IO/SPK_IO_Buffer.h:76:22: note: candidate: ‘void SPK::IO::Buffer::put(char)’
   76 |                 void put(char c);
      |                      ^~~
spark/include/Core/IO/SPK_IO_Buffer.h:96:22: note: candidate: ‘void SPK::IO::Buffer::put(unsigned char)’
   96 |                 void put(unsigned char c)       { put((char)c); }
      |                      ^~~
spark/include/Core/IO/SPK_IO_Buffer.h:97:22: note: candidate: ‘void SPK::IO::Buffer::put(signed char)’
   97 |                 void put(signed char c)         { put((char)c); }

etc.

As there is no overload to 'size_t', the patch casts it to unsigned int.
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