https://bugs.llvm.org/show_bug.cgi?id=42879
Bug ID: 42879
Summary: Candidate template ignored: invalid
explicitly-specified argument for template parameter
Product: clang
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: normal
Priority: P
Component: C++
Assignee: unassignedclangb...@nondot.org
Reporter: m...@mikaelsimonsson.com
CC: blitzrak...@gmail.com, dgre...@apple.com,
erik.pilking...@gmail.com, llvm-bugs@lists.llvm.org,
richard-l...@metafoo.co.uk
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.
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs