bz84080.patch 1015 B

12345678910111213141516171819202122232425262728
  1. Index: gcc/testsuite/g++.dg/cpp1y/auto-fn47.C
  2. ===================================================================
  3. --- gcc/testsuite/g++.dg/cpp1y/auto-fn47.C (nonexistent)
  4. +++ gcc/testsuite/g++.dg/cpp1y/auto-fn47.C (revision 257630)
  5. @@ -0,0 +1,6 @@
  6. +// PR c++/84080
  7. +// { dg-do compile { target c++14 } }
  8. +
  9. +template <int i, typename T> T foo();
  10. +
  11. +template <> auto foo<0>() { return 42; } // { dg-error "does not match" }
  12. Index: gcc/cp/pt.c
  13. ===================================================================
  14. --- gcc/cp/pt.c (revision 257629)
  15. +++ gcc/cp/pt.c (revision 257630)
  16. @@ -2203,6 +2203,11 @@
  17. specialize TMPL will produce DECL. */
  18. continue;
  19. + if (uses_template_parms (targs))
  20. + /* We deduced something involving 'auto', which isn't a valid
  21. + template argument. */
  22. + continue;
  23. +
  24. /* Remove, from the set of candidates, all those functions
  25. whose constraints are not satisfied. */
  26. if (flag_concepts && !constraints_satisfied_p (fn, targs))