<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 - Candidate template ignored: invalid explicitly-specified argument for template parameter"
href="https://bugs.llvm.org/show_bug.cgi?id=42879">42879</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Candidate template ignored: invalid explicitly-specified argument for template parameter
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</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>m@mikaelsimonsson.com
</td>
</tr>
<tr>
<th>CC</th>
<td>blitzrakete@gmail.com, dgregor@apple.com, erik.pilkington@gmail.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk
</td>
</tr></table>
<p>
<div>
<pre>The following code fails to compile with Clang but compiles with GCC (since
7.1). Clang wants a value for the defaulted template parameter Capacity.
#include <cstddef>
template <typename T, size_t Capacity = 10>
class smallvector {
public:
smallvector(const T*, size_t);
};
template <typename T>
class span {
public:
span(const T*, size_t);
};
class str {
public:
str(const char* data, size_t size) : data_{data}, size_{size} {}
template <template <typename> typename Container>
Container<const char> to_container() {
return {data_, size_};
}
private:
const char* data_;
size_t size_;
};
void to_span(str& s) {
s.to_container<span>(); // This works.
}
void to_smallvector(str& s) {
s.to_container<smallvector>(); // This doesn't work.
}
<source>:34:7: error: no matching member function for call to 'to_container'
s.to_container<smallvector>();
~~^~~~~~~~~~~~~~~~~~~~~~~~~
<source>:20:27: note: candidate template ignored: invalid explicitly-specified
argument for template parameter 'Container'
Container<const char> to_container() {
^
1 error generated.
Tested with clang version 10.0.0 (trunk 367740) and -std=c++17.</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>