<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - Incorrect arguments matching in a template class constructor"
href="https://bugs.llvm.org/show_bug.cgi?id=33195">33195</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Incorrect arguments matching in a template class constructor
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>4.0
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>C++
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>dvtikhomirov@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>dgregor@apple.com, llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=18524" name="attach_18524" title="Compilation error">attachment 18524</a> <a href="attachment.cgi?id=18524&action=edit" title="Compilation error">[details]</a></span>
Compilation error
The following program causes compilation error in the Outer class constructor
while the Function is compiled without any problems:
#include <tuple>
struct Inner {
Inner(const char *) {}
};
template <typename T> struct Middle {
Middle(const int &, const T & = {}) {}
};
template <typename... Ts> struct Outer {
Outer(const std::tuple<Middle<Ts>...> &, void * = nullptr) {}
};
template <typename... Ts>
void Function(const std::tuple<Middle<Ts>...> &, void * = nullptr) {}
int main() {
// Compiles ok
Function<Inner, Inner>({{1, "a"}, {2, "b"}});
// Compilation error
Outer<Inner, Inner>({{1, "a"}, {2, "b"}});
return 0;
}
Looks like for some reason clang thinks that tuple's argument is {1, "a"}, not
{{1, "a"}, {2, "b"}}.
If you remove the void* argument from the Outer's constructor, or remove the
default value of T from Middle's constructor, the compilation succeeds.
GCC compiles this without any errors.
clang version 4.0.0 (tags/RELEASE_400/final)
Target: x86_64-unknown-linux-gnu
System: Arch linux</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>