https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80981
Bug ID: 80981 Summary: [7/8 Regression] couldn't deduce template parameter for an obvious case Product: gcc Version: 7.0 Status: UNCONFIRMED Keywords: rejects-valid Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: marxin at gcc dot gnu.org CC: jason at gcc dot gnu.org Target Milestone: --- Starting from r236221 we refuse probably valid code (it's reduced from Chromium): $ cat chrome.ii template <int> class a { template <typename> static void b (int a) { if (a > 0) b (a--); } }; $ g++-7 chrome.ii -c chrome.ii: In static member function ‘static void a<<anonymous> >::b(int)’: chrome.ii:7:13: error: no matching function for call to ‘a<<anonymous> >::b(int)’ b (a--); ^ chrome.ii:4:15: note: candidate: template<int <anonymous> > template<class> static void a<<anonymous> >::b(int) static void b (int a) ^ chrome.ii:4:15: note: template argument deduction/substitution failed: chrome.ii:7:13: note: couldn't deduce template parameter ‘<template-parameter-2-1>’ b (a--); ^