https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71007
Bug ID: 71007 Summary: Divergence between treatment of char[0] between OR (=> SFINAE failure) and diagnostic printing (no failure) Product: gcc Version: 6.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: schaub.johannes at googlemail dot com Target Milestone: --- The following is supposed to tell the user that char[0] is an invalid type, during diagnostic printing. But instead, it infinitely recurses up to SIZE_MAX or something during printing the diagnostic message, eventually crashing #include <utility> #include <tuple> template<typename T, T ...I> auto ignore_n(std::integer_sequence<T, I...>) { return std::make_tuple((I, std::ignore)...); } template<typename... Ts> auto function(Ts... ts) -> decltype((std::tuple_cat( ignore_n(std::make_index_sequence<sizeof(char[int(sizeof...(Ts))-1])-1> ()), std::tuple<double, bool>()) = std::forward_as_tuple(ts...)), void()) { } int main() { function(2); function(1, 2, 3); } Reduced test-case. Here it prints nothing when detailing on why "function" is not callable: main.cpp: In function 'int main()': main.cpp:9:7: error: no matching function for call to 'f(char [1])' f(x); ^ main.cpp:4:6: note: candidate: template<int N, class T> void f(char (&)[N]) void f(char(&)[N]) ^ main.cpp:4:6: note: template argument deduction/substitution failed: