mio icon indicating copy to clipboard operation
mio copied to clipboard

error: no matching function for call to 'empty(const int&)'

Open ClnViewer opened this issue 6 years ago • 3 comments

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 avatar May 08 '19 18:05 ClnViewer

@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!

vimpunk avatar May 10 '19 15:05 vimpunk

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)

vimpunk avatar May 11 '19 14:05 vimpunk

gcc 8.2 mingw-64, 32 bit version. Win10. -std=c++17

ClnViewer avatar Jun 25 '19 03:06 ClnViewer