[Bug c++/81947] New: variadic template specialization doesn't compile
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81947 Bug ID: 81947 Summary: variadic template specialization doesn't compile Product: gcc Version: 4.4.7 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: manish.baphna at citi dot com Target Milestone: --- ->cat vartemp.cpp & g++ vartemp.cpp -std=c++0x template void send(const Type& ...args) { } template <> void send(const int&x, const double& y) { } int main(){ } vartemp.cpp:7: error: template-id âsend<>â for âvoid send(const int&, const double&)â does not match any template declaration gcc version 4.4.7 20120313
[Bug c++/81134] New: C++ partial template specialization issue
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81134 Bug ID: 81134 Summary: C++ partial template specialization issue Product: gcc Version: 6.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: manish.baphna at citi dot com Target Milestone: --- Following code going into recursive template instantiation without realizing terminating case. Works find with clang. template struct GCD { static const int value = (N>M)? GCD::value : GCD::value; }; template struct GCD<0, M>{ static const int value = M; }; template struct GCD { static const int value = M ; }; int main() { static_assert(GCD<12,15>::value == 3, "Error"); } Error: g++ lcd.cpp -std=c++11 fatal error: template instantiation depth exceeds maximum of 900 (use -ftemplate-depth= to increase the maximum) static const int value = (N>M)? GCD::value : GCD::value;
[Bug c++/81134] C++ partial template specialization issue
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81134 --- Comment #2 from Manish --- Thanx Jonathan. Your explanation explains behavior. I wonder if standard has some preference dictated here?
[Bug c++/81134] C++ partial template specialization issue
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81134 --- Comment #4 from Manish --- Which section in particular you are referring? I am looking at this doc, section 14.7 but couldn't find relevant point. http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3690.pdf
[Bug c++/81232] New: compiler crashes for template function overload
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81232 Bug ID: 81232 Summary: compiler crashes for template function overload Product: gcc Version: 6.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: manish.baphna at citi dot com Target Milestone: --- Created attachment 41636 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41636&action=edit diagnostic output from compiler I am trying to use template function overloads and in a specific case, I was expecting to deploy 'best match' overload but that somehow is not happening. Template type deduction there is not matching 'best match' and compiler is crashing(gcc6.1). Explicitly specifying types is helping here. Check main for both versions of my usage. At this moment I am not sure if it's issue with gcc or with my assumptions. Here is code #include #include using namespace std; template using int_ = integral_constant; struct Meta { template static constexpr T ipow(T x) { return ipow(x, int_<(N < 0) ? -1 : N>()); } template static constexpr T ipow(T x, int_<-1>) { return static_cast(1) / ipow<-N>(x, int_<-N>()); } template static constexpr T ipow(T x, int_) { return x * ipow(x, int_()); } template static constexpr T ipow(T x, int_<0>) { return 1; } }; int main(){ Meta m1; cout << m1.ipow<-1, int>(2, int_<-1>()) << endl; // This works fine cout << m1.ipow(2, int_<-1>()) << endl; // This crashes compiler }