- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Folks,
This code fair to compile with -std=c++11 but compiles fine without the -std=c++11 switch.
#include <string>
#include <iostream>
#include <utility>
int main(int argc, char* argv[])
{
std::pair<int, std::string> apair=std::make_pair <int, std::string> ( 66, "sixty-six" );
}
error:/home/michael/programming/compilers/intel/bin/icpc -std=c++11 tt.cpp
tt.cpp(6): error: no instance of function template "std::make_pair" matches the argument list
argument types are: (int, const char [10])
std::pair<int, std::string> apair=std::make_pair <int, std::string> ( 66, "sixty-six" );
/home/michael/programming/compilers/intel/bin/icpc -v
icpc version 14.0.0 (gcc version 4.8.0 compatibility)
g++ --version
g++ (GCC) 4.8.1 20130603 (Red Hat 4.8.1-1)
This is on Fedora 19 X64
Enjoy
michael
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I got the same complaint, regardless of -std=c++11, with several versions of g++, I think icpc is more strict about matching std::string against const char[], without an appropriate cast. Earlier versions of icpc don't get along at all with the latest g++.
It might be interesting to see whether is_convertible shows the same differences between g++ and icpc. But I don't have such a personal interest in language lawyering, in case that's what you mean by "Enjoy!".
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
well Im definitly not a language lawyer but..
the code in the message above compiles with clang 3.3, clang trunk and g++ on fedora and msvc 2012 on windows.
Also this small variant compiles fine with icpc in c++11 mode
#include <string>
#include <iostream>
#include <utility>
int main(int argc, char* argv[])
{
std::string s("sixty six");
std::pair<int, std::string> apair=std::make_pair <int, std::string> ( 66, s.c_str() );
}
michael
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I tried your test case with the newest 14.0 compiler which I could find (14.0.4) and it compiles ok with or without the -std=c++11, looks like that problem was fixed. We're currently shipping 16.0
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
That's correct Melanie. I tried with the next 14.0 version (update release) and it works fine.
@Michael: If you can upgrade to the latest 16.0 release (Initial Release) that'll be nice since a lot of new features/bug fixes etc., has gone into the newer release as well...
_Kittur


- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page