* pt.c (determine_specialization): Print candidates after 'no
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 6 Aug 2015 01:33:32 +0000 (01:33 +0000)
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 6 Aug 2015 01:33:32 +0000 (01:33 +0000)
match' error.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@226653 138bc75d-0d04-0410-961f-82ee72b054a4

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

index 502dc20..986b942 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 5f28f1b..08fb2ff 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" }
+