http://llvm.org/bugs/show_bug.cgi?id=22352
Bug ID: 22352
Summary: single-element initializer_list and overload
resolution
Product: clang
Version: trunk
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P
Component: C++11
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected]
Classification: Unclassified
Hello!
Following code compiles successfully with clang (because it does not invoke 2nd
constructor), while gcc fails (on static_assert, trying to actually call 2nd
constructor).
#include <initializer_list>
#include <cstdio>
template<typename T>
class II
{
public:
II(std::initializer_list<int> l1)
{
printf("one list\n");
}
II(std::initializer_list<int> l1, std::initializer_list<int> l2)
{
static_assert(sizeof(T) == 0, "");
printf("two lists\n");
}
};
int main()
{
II<int> i1{ { 1 }, { 2 } };
II<int> i2{ { { 1 } }, { { 2 } } };
return 0;
}
If clang's behaviour is correct, how do I call 2nd constructor (assuming that I
need to call it with single-element list)?
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs