我尝试了wandbox中的代码:
template<bool B>
void Func(void(*)() noexcept(B)) {}
int main()
{
Func(+[]() noexcept {});
}
编译错误:
prog.cc:7:5: error: no matching function for call to 'Func'
Func(+[]() noexcept {});
^~~~
prog.cc:3:6: note: candidate template ignored: couldn't infer template argument 'B'
void Func(void(*)() noexcept(B)) {}
1 error generated.
^
为什么不能推断出?