mio icon indicating copy to clipboard operation
mio copied to clipboard

Issue with GCC 4.8

Open amallia opened this issue 6 years ago • 4 comments

I had this isse with GCC 4.8 (does not happen with newer compilers). filename is just an std::string (not a reference)

mio::mmap_source m(filename);
error: no matching function for call to ‘mio::basic_mmap<(mio::access_mode)0, char>::basic_mmap(const string&)’
     mio::mmap_source m(filename);
                                ^

I have solved it using:

mio::mmap_source m;
std::error_code error;
m.map(filename, error);

amallia avatar Feb 02 '19 19:02 amallia

Hmm, this is strange. Admittedly I haven't tested on older toolchains. Thanks for reporting, I'll look into it in a bit.

vimpunk avatar Feb 02 '19 20:02 vimpunk

Apologies, had to go out of town for a few days.

So looking at it now I honestly don't know why that errors out as the constructor does the exact same thing as your solution. Do you have any ideas? I was thinking that GCC 4.8 might not fully support C++11, but it looks like it does. However, it looks like its std::string implementation is out of date, if this stackoverflow comment can be trusted. Could that explain it? The string API should be the same, I think.

vimpunk avatar Feb 05 '19 19:02 vimpunk

Apologies, had to go out of town for a few days.

Not a big issue, since there is an alternative solution. I just wanted to open an issue to make other users aware of this.

So looking at it now I honestly don't know why that errors out as the constructor does the exact same thing as your solution. Do you have any ideas? I was thinking that GCC 4.8 might not fully support C++11, but it looks like it does. However, it looks like its std::string implementation is out of date, if this stackoverflow comment can be trusted. Could that explain it? The string API should be the same, I think.

Not sure. I can give it a look if you care about supporting GCC 4.8

amallia avatar Feb 05 '19 19:02 amallia

@amallia It's not a huge priority as I think most people who can use POSIX/Win mmap facilities will have access to the latest compilers. So only spend time on this if you personally care about GCC 4.8 support, I'd say :)

vimpunk avatar Feb 06 '19 08:02 vimpunk