mio
mio copied to clipboard
error: no matching function for call to 'empty(const int&)'
Sample code:
int main()
{
const int fd = open("file.txt", O_RDONLY);
mio::mmap_source mmap(fd, 0, mio::map_entire_file);
produced:
i686-w64-mingw32-g++.exe -o bin\Debug\mio-test.exe obj\Debug\main-full.o
In file included from main-full.cpp:2:
mio.hpp: In instantiation of 'void mio::basic_mmap<AccessMode, ByteT>::map(const String&, mio::basic_mmap<AccessMode, ByteT>::size_type, mio::basic_mmap<AccessMode, ByteT>::size_type, std::error_code&) [with String = int; mio::access_mode AccessMode = (mio::access_mode)0; ByteT = char; mio::basic_mmap<AccessMode, ByteT>::size_type = unsigned int]':
mio.hpp:197:9: required from 'mio::basic_mmap<AccessMode, ByteT>::basic_mmap(const String&, mio::basic_mmap<AccessMode, ByteT>::size_type, mio::basic_mmap<AccessMode, ByteT>::size_type) [with String = int; mio::access_mode AccessMode = (mio::access_mode)0; ByteT = char; mio::basic_mmap<AccessMode, ByteT>::size_type = unsigned int]'
main-full.cpp:26:57: required from here
mio.hpp:1031:21: error: no matching function for call to 'empty(const int&)'
if(detail::empty(path))
~~~~~~~~~~~~~^~~~~~
In file included from main-full.cpp:2:
empty(const int&) realy not found :)
@ClnViewer That is strange, it's invoking the overload with the generic type parameter, instead of the exact match with an int parameter... What compiler and version? Thanks for reporting!
I realized this wasn't part of the tests, so I added it: https://github.com/mandreyel/mio/blob/e101ff3e89bae30ed1065f8643318ae641d68c55/test/test.cpp#L149-L152 which works on my platform (gcc 8.3.1, Linux 5.0.7)
gcc 8.2 mingw-64, 32 bit version. Win10. -std=c++17