- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
When
- a constructor is called with an initializer list, made up of {}-initializers for a user-defined type
icpc complains with
error: no instance of constructor matches the argument list
while gcc (4.8.1) happily compiles the code.
How to reproduce:
#include <string>
#include <vector>
class Element {
public:
Element(std::string const & s) :
data(s)
{ }
Element(std::string && s) :
data(s)
{ }
std::string const & read() const {
return data;
}
private:
std::string data;
};
int main(void) {
std::vector<Element> elements { { "hello" }, { "world" } };
}
Here is the actual error:
$ icpc -std=c++11 test.cpp -o test
test.cc(24): error: no instance of constructor "std::vector<_Tp, _Alloc>::vector [with _Tp=Element, _Alloc=std::allocator<Element>]" matches the argument list
argument types are: ({...}, {...})
std::vector<Element> elements { { "hello" }, { "world" } };
^
compilation aborted for test.cc (code 2)
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for the testcase.
I can see the same error and have filed a bug report (DPD200248554) for it.
Jennifer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
for the record, this is still open with Composer XW 2013 sp1:
$ icpc -v
icpc version 14.0.1 (gcc version 4.8.0 compatibility)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
btw, this issue has been fixed. it should be in the next 14.0 update - update 2.
Jennifer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Andrea,
This issue has been fixed in the latest compiler sp1 update2. I'm closing this issue now ,since the problem has been fixed. Please feel free to reopen it if this is still an issue for you. Thank you for your issue submission.
Thank you.
--
QIAOMINQ.
Intel Developer Support

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