-
Notifications
You must be signed in to change notification settings - Fork 15.1k
Description
| Bugzilla Link | 44890 |
| Resolution | FIXED |
| Resolved on | Feb 19, 2020 04:03 |
| Version | 10.0 |
| OS | All |
| Blocks | #43900 |
| CC | @zmodem,@zygoloid |
| Fixed by commit(s) | 34bd51f |
Extended Description
$ cat reduced.cpp
template <class... Ts>
struct tuple {};
template <unsigned I, class... Ts>
int get0(const tuple<Ts...>& t) {
return 0;
}
template <class... Ts>
struct tuple_wrapper : public tuple<Ts...> {
template
int get() {
return get0<0, Ts...>(*this);
}
};
int f() {
tuple_wrapper w;
return w.get<0>();
}
$ clang -cc1 -fsyntax-only reduced.cpp
reduced.cpp:13:12: error: no matching function for call to 'get0'
return get0<0, Ts...>(*this);
^~~~~~~~~~~~~~
reduced.cpp:19:12: note: in instantiation of function template specialization 'tuple_wrapper::get<0>' requested here
return w.get<0>();
^
reduced.cpp:5:5: note: candidate template ignored: deduced type 'const tuple<>' of 1st parameter does not match adjusted type 'tuple_wrapper' of argument [with I = 0, Ts = <>]
int get0(const tuple<Ts...>& t) {
^
1 error generated.
I bisected this to 907cefe, so it's a regression in 10.0. gcc, MSVC and Clang 9 all accept this code: https://godbolt.org/z/TfZBf2
Clang trunk does compile this if I explicitly instantiate the parent class, but I don't believe that should be necessary, i.e. if I change the body of tuple_wrapper::get to
return get0<0, Ts...>(tuple<Ts...>(*this));