[LLVMbugs] [Bug 22352] New: single-element initializer_list and overload resolution
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Tue Jan 27 08:50:24 PST 2015
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: unassignedclangbugs at nondot.org
Reporter: mikhail.strelnikov at gmail.com
CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150127/b0fd8a7a/attachment.html>
More information about the llvm-bugs
mailing list