pt.c (determine_specialization): Print candidates after 'no match' error.
authorJason Merrill <jason@redhat.com>
Thu, 6 Aug 2015 01:33:32 +0000 (21:33 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Thu, 6 Aug 2015 01:33:32 +0000 (21:33 -0400)
* pt.c (determine_specialization): Print candidates after 'no
match' error.

From-SVN: r226653

gcc/cp/ChangeLog
gcc/cp/pt.c
gcc/testsuite/g++.dg/template/spec39.C [new file with mode: 0644]

index 502dc20430289aeebd7c2d764542469746f49a6f..986b942f40088e84af5ea209d634826e3f74ed18 100644 (file)
@@ -1,5 +1,8 @@
 2015-08-05  Jason Merrill  <jason@redhat.com>
 
+       * pt.c (determine_specialization): Print candidates after 'no
+       match' error.
+
        * decl.c (cp_finish_decl): Tidy.
        * typeck.c (finish_class_member_access_expr): Use
        type_dependent_expression_p.
index 5f28f1b563761be39393ae9eeb48e8c396c91369..08fb2ffb431f3f6d13b8d6e088c1c9a701888309 100644 (file)
@@ -1952,6 +1952,8 @@ determine_specialization (tree template_id,
        b = b->level_chain)
     ++header_count;
 
+  tree orig_fns = fns;
+
   if (variable_template_p (fns))
     {
       tree parms = INNERMOST_TEMPLATE_PARMS (DECL_TEMPLATE_PARMS (fns));
@@ -2168,6 +2170,8 @@ determine_specialization (tree template_id,
        inform (input_location, "saw %d %<template<>%>, need %d for "
                "specializing a member function template",
                header_count, template_count + 1);
+      else
+       print_candidates (orig_fns);
       return error_mark_node;
     }
   else if ((templates && TREE_CHAIN (templates))
diff --git a/gcc/testsuite/g++.dg/template/spec39.C b/gcc/testsuite/g++.dg/template/spec39.C
new file mode 100644 (file)
index 0000000..9e4f8be
--- /dev/null
@@ -0,0 +1,3 @@
+template <class T> void f(T);  // { dg-message "void f" }
+template <> int f(int);                // { dg-error "does not match" }
+