Open llvmbot opened 7 years ago
Confirmed and slightly simplified...
// https://godbolt.org/z/_g-9Bh
template
template
int main() {
static constexpr int I = v
test.cc:16:5: error: no matching function for call to 'f'
f<0>(X()); // clang error
^~~~
test.cc:6:32: note: candidate function template not viable: no known conversion from 'X<...>' to 'X<...>' for 1st argument
template
Extended Description
The code below fail to be compile.
// prog.cc
template struct X {};
template constexpr void f(X) {}
template constexpr int v = [](int r = 0l) constexpr { return r; }();
int main() { f<v>(X<0>());
}
$ clang++ -std=c++1z prog.cc
prog.cc:6:5: error: no matching function for call to 'f' f<v>(X<0>());
^ constexpr void f(X) {}
^
1 error generated.
~~~~ prog.cc:2:32: note: candidate function not viable: no known conversion from 'X<...>' to 'X<...>' for 1st argument templateI think v is always 0, so f<v>(X<0>()) should match f<0>(X<0>);
And if lambda's default parameter type is int,
template constexpr int v = [](int r = 0) constexpr { return r; }();
There are no errors.
This link is the result executed by wandbox. https://wandbox.org/permlink/yjKqrYKQyl2YZ6PO