- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I've got reasons to believe (but couldn't check directly) that the following program
#include <iostream>
#include <initializer_list>
struct foo
{
template<typename... Args>
foo(Args&&...){std::cout<<"int ctor\n";}
foo(std::initializer_list<int>){std::cout<<"init-list ctor\n";}
};
int main()
{
foo x{1};
}
will output "int ctor" rather than "init-list ctor" (which is the right output) in Intel 14.01. Could some with access to the compiler check this out? Thank you!
Joaquín M López Muñoz
Telefónica Digital
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
On Windows, the header "initializer_list" comes with VS2013. so you will need the VS2013 in order to compiler this code. The Intel C++ Compiler 14.0 update 1 supports VS2013, and it compiles this code fine:
C:\temp>type init.cpp
#include <iostream>
#include <initializer_list>
struct foo
{
template<typename... Args>
foo(Args&&...){std::cout<<"int ctor\n";}
foo(std::initializer_list<int>){std::cout<<"init-list ctor\n";}
};
int main()
{
foo x{1};
}
C:\temp>
C:\temp>icl /c init.cpp
Intel(R) C++ Compiler XE for applications running on IA-32, Version 14.0.1.139 Build 20131008
Copyright (C) 1985-2013 Intel Corporation. All rights reserved.
init.cpp
C:\temp>icl /c init.cpp
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Jennifer,
Can you pleasee run the resulting executable and report back its output. I think it's going to be "int ctor" rather than "init-list ctor", which would indicate a problem with the compiler's support of initializer_lists.
Thank you,
Joaquín M López Muñoz
Telefónica Digital
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I got the answer as following:
C:\temp>init
init-list ctor
C:\temp>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How weird, I've distilled this down from a more complex scenario where such a bug seemed to be occuring. Thank you!
Joaquín M López Muñoz
Telefónica Digital

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