- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I believe this is a bug. G++ compiles it as I'd expect, and my reading of the C++11 docs would seem to indicate this is a valid construct. I'm using icpc 12.1.0 20110811.
Compile with g++ -std=c++0x or icpc -std=c++0x
icpc complains with:
Any suggestions for an alternate construct? Confirmation that this is a bug? Or are initializer lists just not supported in ICPC yet?
Thanks!
[cpp]#include#include class CConfig { public: const char *name; bool flag; std::vector items; CConfig(const char *n, bool f, std::initializer_list i) { name = n; flag = f; for (auto itr = i.begin(); itr != i.end(); ++itr) items.push_back(*itr); } }; static CConfig config("first", true, { 1, 2, 3, 4 }); static CConfig config2 = { "first", true, { 1, 2, 3, 4 } }; int main() { printf("config.name=%s\n", config.name); } [/cpp]
Compile with g++ -std=c++0x or icpc -std=c++0x
icpc complains with:
[plain]bug.cc(18): error: expected an expression static CConfig config("first", true, { 1, 2, 3, 4 }); ^ bug.cc(19): error: initialization with "{...}" is not allowed for object of type "CConfig" static CConfig config2 = { "first", true, { 1, 2, 3, 4 } }; ^ compilation aborted for bug.cc (code 2) [/plain]
Any suggestions for an alternate construct? Confirmation that this is a bug? Or are initializer lists just not supported in ICPC yet?
Thanks!
Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi there,
Thanks for the small test case. I've reproduced the problem and entered it to our problem-tracking database. I'll let you know when I have an update regarding this issue.
Thanks for the small test case. I've reproduced the problem and entered it to our problem-tracking database. I'll let you know when I have an update regarding this issue.
Thank you. -- Feilong H. Intel Developer Support Tools Knowledge Base: http://software.intel.com/en-us/articles/tools |
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
C++0x general and extendedinitalizer lists are not a feature we ever intended to support in version 12.1. So this is not really a bug, it is an intentionally unimplemented feature. We have no plans to backport this feature into 12.1. We are trying to finish theimplementationin our next major release of the compiler.
Sorry for the inconvenience.
Judy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This feature has been implemented in 14.0 compiler. So I'm closing this thread now.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page