Reputation: 3335
I've installed the latest MinGW (8.1.0) and have tested with Eclipse Neon and Photon
#include <iostream>
#include <unordered_map>
int main(){
std::unordered_map<int,std::string> dict = {{1,"one"},{2,"two"}};
dict.insert({3,"three"});
for(const auto& p: dict){std::cout << p.first << " = " << p.second << std::endl;}
}
it compiles fine, but the insert
method is underlined red.
Eclipse gives the error: 'insert' is ambiguous
is there any way to update the eclipse indexer or something?
EDIT:
casting an argument to const removes the syntax error
dict.insert(std::pair<const int,std::string>{3,"three"});
EDIT 2:
or you can use MinGW (5.1.0) with C++11 dialect
EDIT 3:
Eclipse Photon R
GCC 7.3.0
EDIT 4:
CDT 9.5.5 for Photon (19th Nov 2018)
Eclipse 4.6 (Neon 2016) is no longer supported. (CDT 9.2)
Eclipse 4.8 (Photon 2018) is no longer supported. (CDT 9.5)
Eclipse 4.9 (2019) is now on the rise, starting with CDT 9.6.
Upvotes: 1
Views: 444
Reputation: 52739
This is an issue affecting GCC 8 standard library headers, tracked in Eclipse bug 540957. It was fixed for CDT 9.6 (released as part of Eclipse 2018-12).
UPDATE: The bug was also fixed for CDT 9.5.5, which is planned for an out-of-band release on 2018-11-19. If you're running Eclipse Photon or later, Help -> Check for Updates
should pick up this update once it's out.
A workaround until then is to use GCC 7 or earlier.
Upvotes: 3