Why couldn't deduce const& template parameter?
问题 Consider this code: constexpr int TEN = 10; template < const int& > struct Object { }; template < const int& II > void test(Object<II>) { } Then the calls: test<TEN>(Object<TEN>{}); // passes test(Object<TEN>{}); // FAILS The second call fails to compile with error message: error: no matching function for call to ‘test(Object<TEN>) note: candidate: template<const int& II> void test(Object<II>) note: template argument deduction/substitution failed: note: couldn't deduce template parameter ‘II’