]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
PR c++/20669
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 12 May 2010 17:34:55 +0000 (17:34 +0000)
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 12 May 2010 17:34:55 +0000 (17:34 +0000)
* call.c (add_template_candidate_real): If deduction fails, still
add the template as a non-viable candidate.
(equal_functions): Handle template candidates.
(print_z_candidate): Likewise.
(print_z_candidates): Likewise.
(build_new_function_call): Likewise.

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

70 files changed:
gcc/cp/ChangeLog
gcc/cp/call.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/conversion/op1.C
gcc/testsuite/g++.dg/cpp0x/nullptr15.C
gcc/testsuite/g++.dg/cpp0x/pr31431-2.C
gcc/testsuite/g++.dg/cpp0x/pr31431.C
gcc/testsuite/g++.dg/cpp0x/temp_default2.C
gcc/testsuite/g++.dg/cpp0x/trailing4.C
gcc/testsuite/g++.dg/cpp0x/variadic-ex3.C
gcc/testsuite/g++.dg/cpp0x/variadic-ex4.C
gcc/testsuite/g++.dg/cpp0x/variadic-throw.C
gcc/testsuite/g++.dg/cpp0x/variadic35.C
gcc/testsuite/g++.dg/cpp0x/vt-35147.C
gcc/testsuite/g++.dg/cpp0x/vt-37737-1.C
gcc/testsuite/g++.dg/cpp0x/vt-37737-2.C
gcc/testsuite/g++.dg/ext/visibility/anon8.C
gcc/testsuite/g++.dg/ext/vla2.C
gcc/testsuite/g++.dg/other/pr28114.C
gcc/testsuite/g++.dg/other/ptrmem10.C
gcc/testsuite/g++.dg/other/ptrmem11.C
gcc/testsuite/g++.dg/overload/unknown1.C
gcc/testsuite/g++.dg/parse/template7.C
gcc/testsuite/g++.dg/parse/typename7.C
gcc/testsuite/g++.dg/template/conv11.C
gcc/testsuite/g++.dg/template/copy1.C
gcc/testsuite/g++.dg/template/deduce3.C
gcc/testsuite/g++.dg/template/dependent-expr5.C
gcc/testsuite/g++.dg/template/friend.C
gcc/testsuite/g++.dg/template/incomplete2.C
gcc/testsuite/g++.dg/template/local4.C
gcc/testsuite/g++.dg/template/local6.C
gcc/testsuite/g++.dg/template/operator10.C
gcc/testsuite/g++.dg/template/overload6.C
gcc/testsuite/g++.dg/template/ptrmem2.C
gcc/testsuite/g++.dg/template/ptrmem20.C
gcc/testsuite/g++.dg/template/ptrmem8.C
gcc/testsuite/g++.dg/template/sfinae2.C
gcc/testsuite/g++.dg/template/ttp25.C
gcc/testsuite/g++.dg/template/unify10.C
gcc/testsuite/g++.dg/template/unify11.C
gcc/testsuite/g++.dg/template/unify6.C
gcc/testsuite/g++.dg/template/unify7.C
gcc/testsuite/g++.dg/template/unify9.C
gcc/testsuite/g++.dg/template/varmod1.C
gcc/testsuite/g++.old-deja/g++.brendan/crash56.C
gcc/testsuite/g++.old-deja/g++.law/operators32.C
gcc/testsuite/g++.old-deja/g++.pt/crash28.C
gcc/testsuite/g++.old-deja/g++.pt/crash60.C
gcc/testsuite/g++.old-deja/g++.pt/explicit38.C
gcc/testsuite/g++.old-deja/g++.pt/explicit39.C
gcc/testsuite/g++.old-deja/g++.pt/explicit41.C
gcc/testsuite/g++.old-deja/g++.pt/explicit67.C
gcc/testsuite/g++.old-deja/g++.pt/explicit77.C
gcc/testsuite/g++.old-deja/g++.pt/expr2.C
gcc/testsuite/g++.old-deja/g++.pt/overload7.C
gcc/testsuite/g++.old-deja/g++.pt/ptrmem6.C
gcc/testsuite/g++.old-deja/g++.pt/spec5.C
gcc/testsuite/g++.old-deja/g++.pt/spec6.C
gcc/testsuite/g++.old-deja/g++.pt/t24.C
gcc/testsuite/g++.old-deja/g++.pt/unify4.C
gcc/testsuite/g++.old-deja/g++.pt/unify6.C
gcc/testsuite/g++.old-deja/g++.pt/unify8.C
gcc/testsuite/g++.old-deja/g++.robertl/eb119.C
gcc/testsuite/g++.old-deja/g++.robertl/eb79.C
gcc/testsuite/g++.old-deja/g++.robertl/eb98.C
libstdc++-v3/ChangeLog
libstdc++-v3/testsuite/20_util/auto_ptr/assign_neg.cc
libstdc++-v3/testsuite/20_util/unique_ptr/assign/assign_neg.cc
libstdc++-v3/testsuite/20_util/weak_ptr/comparison/cmp_neg.cc

index 97dcc8d7aec558cd5638befd9f5e267abad7e122..5f0569ad07be3d689ab96b0de9eae0d1d8075ec5 100644 (file)
@@ -1,5 +1,13 @@
 2010-05-12  Jason Merrill  <jason@redhat.com>
 
+       PR c++/20669
+       * call.c (add_template_candidate_real): If deduction fails, still
+       add the template as a non-viable candidate.
+       (equal_functions): Handle template candidates.
+       (print_z_candidate): Likewise.
+       (print_z_candidates): Likewise.
+       (build_new_function_call): Likewise.
+
        * cp-tree.h (LOOKUP_LIST_ONLY): New.
        * call.c (add_candidates): Enforce it.
        (build_new_method_call): Try non-list ctor if no viable list ctor.
index c618b2938af8e01166584366a09a53990d73723b..dccb1d4fbfe9a3bb5ab053645ee228492254f275 100644 (file)
@@ -2508,11 +2508,11 @@ add_template_candidate_real (struct z_candidate **candidates, tree tmpl,
                           return_type, strict, flags);
 
   if (i != 0)
-    return NULL;
+    goto fail;
 
   fn = instantiate_template (tmpl, targs, tf_none);
   if (fn == error_mark_node)
-    return NULL;
+    goto fail;
 
   /* In [class.copy]:
 
@@ -2541,7 +2541,7 @@ add_template_candidate_real (struct z_candidate **candidates, tree tmpl,
       tree arg_types = FUNCTION_FIRST_USER_PARMTYPE (fn);
       if (arg_types && same_type_p (TYPE_MAIN_VARIANT (TREE_VALUE (arg_types)),
                                    ctype))
-       return NULL;
+       goto fail;
     }
 
   if (obj != NULL_TREE)
@@ -2575,6 +2575,9 @@ add_template_candidate_real (struct z_candidate **candidates, tree tmpl,
     cand->template_decl = DECL_TEMPLATE_INFO (fn);
 
   return cand;
+ fail:
+  return add_candidate (candidates, tmpl, first_arg, arglist, nargs, NULL,
+                       access_path, conversion_path, 0);
 }
 
 
@@ -2607,10 +2610,10 @@ add_template_conv_candidate (struct z_candidate **candidates, tree tmpl,
 }
 
 /* The CANDS are the set of candidates that were considered for
-   overload resolution.  Return the set of viable candidates.  If none
-   of the candidates were viable, set *ANY_VIABLE_P to true.  STRICT_P
-   is true if a candidate should be considered viable only if it is
-   strictly viable.  */
+   overload resolution.  Return the set of viable candidates, or CANDS
+   if none are viable.  If any of the candidates were viable, set
+   *ANY_VIABLE_P to true.  STRICT_P is true if a candidate should be
+   considered viable only if it is strictly viable.  */
 
 static struct z_candidate*
 splice_viable (struct z_candidate *cands,
@@ -2675,6 +2678,10 @@ build_this (tree obj)
 static inline int
 equal_functions (tree fn1, tree fn2)
 {
+  if (TREE_CODE (fn1) != TREE_CODE (fn2))
+    return 0;
+  if (TREE_CODE (fn1) == TEMPLATE_DECL)
+    return fn1 == fn2;
   if (DECL_LOCAL_FUNCTION_P (fn1) || DECL_LOCAL_FUNCTION_P (fn2)
       || DECL_EXTERN_C_FUNCTION_P (fn1))
     return decls_match (fn1, fn2);
@@ -2710,7 +2717,7 @@ print_z_candidate (const char *msgstr, struct z_candidate *candidate)
     inform (input_location, "%s %T <conversion>", msgstr, candidate->fn);
   else if (candidate->viable == -1)
     inform (input_location, "%s %+#D <near match>", msgstr, candidate->fn);
-  else if (DECL_DELETED_FN (candidate->fn))
+  else if (DECL_DELETED_FN (STRIP_TEMPLATE (candidate->fn)))
     inform (input_location, "%s %+#D <deleted>", msgstr, candidate->fn);
   else
     inform (input_location, "%s %+#D", msgstr, candidate->fn);
@@ -2750,12 +2757,12 @@ print_z_candidates (struct z_candidate *candidates)
     {
       tree fn = cand1->fn;
       /* Skip builtin candidates and conversion functions.  */
-      if (TREE_CODE (fn) != FUNCTION_DECL)
+      if (!DECL_P (fn))
        continue;
       cand2 = &cand1->next;
       while (*cand2)
        {
-         if (TREE_CODE ((*cand2)->fn) == FUNCTION_DECL
+         if (DECL_P ((*cand2)->fn)
              && equal_functions (fn, (*cand2)->fn))
            *cand2 = (*cand2)->next;
          else
@@ -3167,7 +3174,8 @@ build_new_function_call (tree fn, VEC(tree,gc) **args, bool koenig_p,
     {
       if (complain & tf_error)
        {
-         if (!any_viable_p && candidates && ! candidates->next)
+         if (!any_viable_p && candidates && ! candidates->next
+             && (TREE_CODE (candidates->fn) == FUNCTION_DECL))
            return cp_build_function_call_vec (candidates->fn, args, complain);
          if (TREE_CODE (fn) == TEMPLATE_ID_EXPR)
            fn = TREE_OPERAND (fn, 0);
index f0f5c2390a955f09a1356aff50109590b0c4ccf0..a3200c944048b0c76b79aac69b14875208c3ba52 100644 (file)
@@ -1,5 +1,69 @@
 2010-05-12  Jason Merrill  <jason@redhat.com>
 
+       * g++.dg/conversion/op1.C: Expect template candidate message.
+       * g++.dg/cpp0x/nullptr15.C: Likewise.
+       * g++.dg/cpp0x/pr31431-2.C: Likewise.
+       * g++.dg/cpp0x/pr31431.C: Likewise.
+       * g++.dg/cpp0x/temp_default2.C: Likewise.
+       * g++.dg/cpp0x/trailing4.C: Likewise.
+       * g++.dg/cpp0x/variadic-ex3.C: Likewise.
+       * g++.dg/cpp0x/variadic-ex4.C: Likewise.
+       * g++.dg/cpp0x/variadic-throw.C: Likewise.
+       * g++.dg/cpp0x/variadic35.C: Likewise.
+       * g++.dg/cpp0x/vt-35147.C: Likewise.
+       * g++.dg/cpp0x/vt-37737-1.C: Likewise.
+       * g++.dg/cpp0x/vt-37737-2.C: Likewise.
+       * g++.dg/ext/visibility/anon8.C: Likewise.
+       * g++.dg/ext/vla2.C: Likewise.
+       * g++.dg/other/pr28114.C: Likewise.
+       * g++.dg/other/ptrmem10.C: Likewise.
+       * g++.dg/other/ptrmem11.C: Likewise.
+       * g++.dg/overload/unknown1.C: Likewise.
+       * g++.dg/parse/template7.C: Likewise.
+       * g++.dg/parse/typename7.C: Likewise.
+       * g++.dg/template/conv11.C: Likewise.
+       * g++.dg/template/copy1.C: Likewise.
+       * g++.dg/template/deduce3.C: Likewise.
+       * g++.dg/template/dependent-expr5.C: Likewise.
+       * g++.dg/template/friend.C: Likewise.
+       * g++.dg/template/incomplete2.C: Likewise.
+       * g++.dg/template/local4.C: Likewise.
+       * g++.dg/template/local6.C: Likewise.
+       * g++.dg/template/operator10.C: Likewise.
+       * g++.dg/template/overload6.C: Likewise.
+       * g++.dg/template/ptrmem2.C: Likewise.
+       * g++.dg/template/ptrmem20.C: Likewise.
+       * g++.dg/template/ptrmem8.C: Likewise.
+       * g++.dg/template/sfinae2.C: Likewise.
+       * g++.dg/template/ttp25.C: Likewise.
+       * g++.dg/template/unify10.C: Likewise.
+       * g++.dg/template/unify11.C: Likewise.
+       * g++.dg/template/unify6.C: Likewise.
+       * g++.dg/template/unify7.C: Likewise.
+       * g++.dg/template/unify9.C: Likewise.
+       * g++.dg/template/varmod1.C: Likewise.
+       * g++.old-deja/g++.brendan/crash56.C: Likewise.
+       * g++.old-deja/g++.law/operators32.C: Likewise.
+       * g++.old-deja/g++.pt/crash28.C: Likewise.
+       * g++.old-deja/g++.pt/crash60.C: Likewise.
+       * g++.old-deja/g++.pt/explicit38.C: Likewise.
+       * g++.old-deja/g++.pt/explicit39.C: Likewise.
+       * g++.old-deja/g++.pt/explicit41.C: Likewise.
+       * g++.old-deja/g++.pt/explicit67.C: Likewise.
+       * g++.old-deja/g++.pt/explicit77.C: Likewise.
+       * g++.old-deja/g++.pt/expr2.C: Likewise.
+       * g++.old-deja/g++.pt/overload7.C: Likewise.
+       * g++.old-deja/g++.pt/ptrmem6.C: Likewise.
+       * g++.old-deja/g++.pt/spec5.C: Likewise.
+       * g++.old-deja/g++.pt/spec6.C: Likewise.
+       * g++.old-deja/g++.pt/t24.C: Likewise.
+       * g++.old-deja/g++.pt/unify4.C: Likewise.
+       * g++.old-deja/g++.pt/unify6.C: Likewise.
+       * g++.old-deja/g++.pt/unify8.C: Likewise.
+       * g++.old-deja/g++.robertl/eb119.C: Likewise.
+       * g++.old-deja/g++.robertl/eb79.C: Likewise.
+       * g++.old-deja/g++.robertl/eb98.C: Likewise.
+
        * g++.dg/cpp0x/initlist32.C: New.
 
        * g++.dg/template/conv11.C: New.
index 990cdaa093b7b8fecf0e672382d7fc360f537ccc..65b925a4d61d944fcc5cdbb06678b9f231a28384 100644 (file)
@@ -1,7 +1,7 @@
 class C
 {
   template<typename U> 
-  operator U();
+  operator U();                        // { dg-message "candidate" }
 };
 
 int fn (C c) 
index 4572c535d4fa304ab20ced85ba73f06e29809277..abb45f4e9374568c48e36e03cd3c11acab3b4dfd 100644 (file)
@@ -10,7 +10,7 @@ template <typename T, typename U>
 inline typename tType_equal<T, U>::type
 type_equal(U) { }
 
-template<typename T> T* g( T* t );
+template<typename T> T* g( T* t ); // { dg-message "candidate" }
 
 void test_g()
 {
index 2f74e38ca3bc6f950caa9eddf064f8be6fa3eba3..59e1afeab25a88b88355af74be05cb3ad0b7b47e 100644 (file)
@@ -1,5 +1,5 @@
 // { dg-options "-std=gnu++0x" }
-template<typename, typename..., typename> void foo();
+template<typename, typename..., typename> void foo(); // { dg-message "candidate" }
 
 void bar()
 {
index 061dab0a601b81210cbf555653a1c3e6de344cc5..b150a047f8c05ba3341e10b1b88f5547bb3a5f76 100644 (file)
@@ -1,5 +1,5 @@
 // { dg-options "-std=gnu++0x" }
-template<typename..., typename> void foo();
+template<typename..., typename> void foo(); // { dg-message "candidate" }
 
 void bar()
 {
index f7f22284a6266efbf5648dfecdcfd086b9e4da16..5a9cbe03e743154df13aa7558f9b9472a0a30fb6 100644 (file)
@@ -1,7 +1,7 @@
 // { dg-options "-std=c++0x" }
 
 template <class T, class U = double> 
-void f(T t = 0, U u = 0); 
+void f(T t = 0, U u = 0);      // { dg-message "candidate" }
 
 void g() 
 { 
index dc7e35aabaa4afecaf293be3869659c46fa879a3..247efd4b56cb8dcc0cb480a30fe382d801234101 100644 (file)
@@ -5,7 +5,7 @@ template<class T, class U>
 auto f(T,U) -> decltype(T() + U())
 { return T() + U(); }
 
-template<class T> void g(T){}
+template<class T> void g(T){}  // { dg-message "candidate" }
 
 int main() { g(f); }           // { dg-error "no matching function" }
 
index 8b8ca9e312dc619c2736adb4d2149731841d5895..60c47176d0029bb61989228e8faa517f424d6915 100644 (file)
@@ -1,5 +1,5 @@
 // { dg-options "-std=gnu++0x" }
-template<class X, class Y, class... Z> X f(Y); 
+template<class X, class Y, class... Z> X f(Y); // { dg-message "candidate" }
 void g() 
 { 
   int i = f<int>(5.6);
index 69866dcb13d7a4f72a3e7c40ba1d5cb91b9e6a2e..b8aec1f5140c428e4260c8214bac343a0c736b2e 100644 (file)
@@ -1,5 +1,5 @@
 // { dg-options "-std=gnu++0x" }
-template<class X, class Y, class Z> X f(Y,Z); 
+template<class X, class Y, class Z> X f(Y,Z); // { dg-message "candidate" }
 template<class... Args> void f2();
 void g() 
 { 
index ee85bf2a5692c7ff45a38c20301574484d742792..8363c2a73f98f3580eb76d4d3e781b7949ddafc9 100644 (file)
@@ -1,4 +1,5 @@
 // { dg-options -std=c++0x }
+// { dg-prune-output "note" }
 // PR c++/33509
 template<int M, int N> struct pair
 {
index cd6ba2b0a0cc10daff7ffa620407f3d81d81547d..a85771d1595681e638f40bdd72ff5fb0d2f1d4ef 100644 (file)
@@ -1,6 +1,6 @@
 // { dg-options "-std=gnu++0x" }
 template<int I, typename... Args>
-void get_ith(const Args&... args);
+void get_ith(const Args&... args); // { dg-message "candidate" }
 
 void f()
 {
index 67f282ef9c3829db0c7cd7a8548239103ed7b5c5..9008180799b1e41594a1a8a7c58c11c41e959097 100644 (file)
@@ -1,7 +1,7 @@
 // { dg-options "-std=c++0x" }
 
 template<typename _Tp>
-  _Tp&& forward(_Tp&& __t) { return __t; }
+  _Tp&& forward(_Tp&& __t) { return __t; } // { dg-message "candidate" }
 
 void f(...);
 
index 32ea22db2783388cea27f9725f400581569388f4..de11b1651b43a9cd5dd7b45d290d4a4b09f9aa74 100644 (file)
@@ -1,4 +1,5 @@
 // { dg-options "-std=c++0x" }
+// { dg-prune-output "note" }
 
 void f() { }
 
index 11547e5e24954b036f56a0eb7f4939793dff5d6e..16df69bd89285d9e812a3ef6f03f092323eb842a 100644 (file)
@@ -1,7 +1,7 @@
 // { dg-options "-std=c++0x" }
 
 template<class U, class... T>
-void f()
+void f()                       // { dg-message "candidate" }
 {
   f<T...>(); // { dg-error "no matching" }
 }
index 827cc221741400e196ca0d96d9229b7ba19172b2..b0d3849b26fe0ee6dcba4ea224a21af40a074dee 100644 (file)
@@ -2,7 +2,7 @@
 // { dg-do compile }
 
 template <void (*fn) ()>
-void call ()
+void call ()                   // { dg-message "candidate" }
 {
   fn ();
 }
index c17dc860910cd37b86f44347177c3ea6294fc3f0..5e37f8a5fc2c96e1617fb4b02bf21dc836bbd302 100644 (file)
@@ -8,7 +8,7 @@
 // errors.
 
 template <unsigned int N>
-char* begin(char (&a) [N] );
+char* begin(char (&a) [N] );   // { dg-message "candidate" }
 
 void bar(int i)
 {
index e370f717c3a9e08b7ef80b22f272442cfffe4475..d54fec960857aa4dc4afa9b979fcddb79ad9f60a 100644 (file)
@@ -1,7 +1,7 @@
 
 // Test to make sure we do not ICE on this invalid program.
 
-template<int> void foo(struct {}*); // { dg-error "" }
+template<int> void foo(struct {}*); // { dg-message "" }
 
 void bar()
 {
index 4b8c40ac8ecb53f8ae0726cc988c4799b9b93c45..53d5c85a80794d8b044110a642bbb3a0ca9f1b84 100644 (file)
@@ -3,7 +3,7 @@
 
 template <class C, void (C::*M) ()>
 static
-void foo(void *obj)
+void foo(void *obj)            // { dg-message "candidate" }
 {
   C *p = static_cast<C*>(obj);
   (p->*M)();
index a850c55c40a13f5c70790de974c8d43449efb8fe..c1c8677c9dc07ea59aa1807ceb97a6077884cb05 100644 (file)
@@ -5,7 +5,7 @@ struct A {};
 
 template <int A::* p>
 int
-foo(A* q)
+foo(A* q)                      // { dg-message "candidate" }
 {
   return q->*p;
 }
index f34d79ffc08d783d70a7faff24b41fe92f0550fe..61b60b063cd798f4dfce30274991c6c0dfb8384b 100644 (file)
@@ -2,7 +2,7 @@
 
 void foo(void);
 int foo(int);
-template <typename T> void bar(T f);
+template <typename T> void bar(T f); // { dg-message "candidate" }
 
 void baz() {
   bar(foo); // { dg-error "<unresolved overloaded function type>" }
index b13e3eccde43c4f40d657a00f0adfc830cd37aa2..e07d5f85d8f3e1c8dd1e7158e16f6c4a44e73d10 100644 (file)
@@ -1,4 +1,4 @@
 template <int I>
-void f();
+void f();                      // { dg-message "candidate" }
 
 void g() { f<(3, 2)>(); } // { dg-error "" }
index 3cee4bac68bf7fbbe1b10b2e7bffa7ae9b7ce2a2..0ac53112126bd4c7d466b7123f3de5717fd4b3be 100644 (file)
@@ -7,8 +7,8 @@
 
 struct A
 {
-  template<typename>   void foo(int);
-  template<typename T> void bar(T t) {
+  template<typename>   void foo(int); // { dg-message "candidate" }
+  template<typename T> void bar(T t) { // { dg-message "candidate" }
     this->foo<typename T>(t); } // { dg-error "expected|parse error|no matching" }
   template<typename T> void bad(T t) {
     foo<typename T>(t); } // { dg-error "expected|parse error|no matching" }
index 846b852f493eef32e63b0db10913a97d8f835929..de41d6a2122d6a7034c3c427790440d916991455 100644 (file)
@@ -1,7 +1,7 @@
 int i;
 struct A
 {
-  template <class T> operator T&() { return i; }
+  template <class T> operator T&() { return i; } // { dg-message "candidate" }
 };
 
 int main()
index e56545332aed73dfffcafc7553a589bef48e1a2d..bec506dd991fa19d8f885d30e46d7a60a8059666 100644 (file)
@@ -6,8 +6,8 @@
 
 struct A
 {
-  A(A&); // { dg-message "candidate" }
-  template <class T> A(T); 
+  A(A&); // { dg-message "note" }
+  template <class T> A(T);     // { dg-message "candidate" }
 };
 
 A a = 0; // { dg-error "no matching function" }
index d6d68a81bc72642d784df7d5ccb096b8aed0331f..fbf41e0e32850452c838a80c4bcbdcc9a6500975 100644 (file)
@@ -1,5 +1,5 @@
 template <typename T>
-void f(int, T (*)() = 0);
+void f(int, T (*)() = 0);      // { dg-message "candidate" }
 
 void g() {
   typedef int A[2];
index db67273b36203c0fa0a4ddda20fbc181cdb2d4cb..b36d38233e9eaa1e83731ef228aa2482011d4f3d 100644 (file)
@@ -4,9 +4,9 @@
 // contributed by Alexandre Oliva <aoliva@redhat.com>
 // inspired in the failure reported in Red Hat bugzilla #168260.
 
-template<class F> void bind(F f) {}
+template<class F> void bind(F f) {} // { dg-message "note" }
 
-template<class F> void bindm(F f) {}
+template<class F> void bindm(F f) {} // { dg-message "note" }
 template<class F, class T> void bindm(F (T::*f)(void)) {} // { dg-message "note" }
 
 template<class F> void bindn(F f) {}
index 5e9abb0b52a051e50e45225b0037d13ed9eaa431..ac22f2ffb2de003d235ff425ae5c6cc55f9fe00c 100644 (file)
@@ -7,7 +7,7 @@ extern ostream& cout;
 template <class T> struct s;
 
 template <class T>
-ostream& operator<<(ostream &o, const typename s<T>::t &x)
+ostream& operator<<(ostream &o, const typename s<T>::t &x) // { dg-message "note" }
 {
   return o;
 }
index 23d393e99df097cd1201df6f4ccff0a535ebaf00..73b6c6fd64d816d224e02f197db3e2a5f3fac7cb 100644 (file)
@@ -3,7 +3,7 @@
 
 struct A;
 
-template<A&> void foo();
+template<A&> void foo();       // { dg-message "candidate" }
 
 A a;  // { dg-error "incomplete type" }
 
index cfa37364975b27430ef47271e71d67aee7b3b33c..e3044e993eea2843f212fa029e202f9569d9b066 100644 (file)
@@ -1,6 +1,6 @@
 // PR c++/17413
 
-template <typename T> void foo() {}
+template <typename T> void foo() {} // { dg-message "candidate" }
 
 int main () {
   struct S {};
index 6c5e8ac7022ccd0998bf539790bd6b2b70dd8c13..1fa39bc7a758eebf6ed2c84038a86b8497e4e25b 100644 (file)
@@ -1,6 +1,6 @@
-template <class T> struct PCVector2 // { dg-message "candidate is" }
+template <class T> struct PCVector2 // { dg-message "note" }
 {
-    template <class T2> PCVector2(const PCVector2<T> &cv) ;
+    template <class T2> PCVector2(const PCVector2<T> &cv) ; // { dg-message "candidate" }
 
     PCVector2<T> operator- (const PCVector2<T> &ov) const 
        { 
index b17f49fa9f70e8a36d4ec8b43350b7334377f456..448b022905fc109bc43617f8cd032ce8cb1d72ed 100644 (file)
@@ -1,4 +1,5 @@
 // PR c++/30535
+// { dg-prune-output "note" }
 
 struct A {};
 
index 478b466394ad6dab21b3c95bcc5821a2451e5fae..fd868333447d345c47e658ecf80f4a64b622728d 100644 (file)
@@ -4,7 +4,7 @@
 // PR 21592:ICE
 // Origin:  Volker Reichelt <reichelt@gcc.gnu.org>
 
-template<typename T> void unique(T,T);
+template<typename T> void unique(T,T); // { dg-message "note" }
 
 struct A
 {
index 23a4ad9380b4cb012c02189d33d3f716b177df6f..848a6d9cca0e1a07483379e95caeaee49d4e5628 100644 (file)
@@ -7,7 +7,7 @@
 
 struct A {};
 
-template <typename T> T A::* Foo ();
+template <typename T> T A::* Foo (); // { dg-message "candidate" }
 
 void Baz ()
 {
index d98ef398c585c713d15170691cba345970290748..23488737a6771f10abee5b64b50a86ab8375fe3a 100644 (file)
@@ -8,7 +8,7 @@ struct B
   void foo();
 };
 
-template<void (A::*)()> void bar();
+template<void (A::*)()> void bar(); // { dg-message "candidate" }
 
 void baz()
 {
index e25b4084129b7236c638144792b24aeb38915f5a..8585f83578737b9bc80b43c4cbe65571a87eaecf 100644 (file)
@@ -11,7 +11,7 @@ struct B
 
 struct D : B {};
 
-template <int (D::*fun)() const> int Get();
+template <int (D::*fun)() const> int Get(); // { dg-message "candidate" }
 
 int main () 
 {
index 89880a85f4345f1583d83ccb783ff80d5a3dbe60..0b11ecc0f020c8f7fac6b45b45099fa560cc6aab 100644 (file)
@@ -8,7 +8,7 @@ template<int T> struct cl {
   const static int value = T;
 };
 
-template<int I> void fn (char (*) [cl<I>::value] = 0 );
+template<int I> void fn (char (*) [cl<I>::value] = 0 ); // { dg-message "candidate" }
 
 void foo (void)
 {
index 89153037913cae849953c5fdcec718e600d96f90..23e5a7a799099129cff23dc944dc9fc55c9d0b20 100644 (file)
@@ -1,19 +1,19 @@
 // { dg-do compile }
 template<typename T, template<T> class C>
-void f1(T, C<5>);
+void f1(T, C<5>);              // { dg-message "note" }
 
 template<typename T, template<T> class C>
 void f2(C<5>, T);
 
 template<typename T, template<T> class C>
-void f3(C<5>, T);
+void f3(C<5>, T);              // { dg-message "note" }
 
 template<typename T> struct metafun { typedef T type; };
 
 template<> struct metafun<short> { typedef int type; };
 
 template<typename T, template<typename metafun<T>::type> class C>
-void f4(T, C<5>);
+void f4(T, C<5>);              // { dg-message "note" }
 
 template<int N> struct X {};
 void g() {
index b46c693e01f50cbc9adca6a3cba1821545d15902..7b19e1ebfe82d3267988af7d3317bb7b6216177d 100644 (file)
@@ -12,16 +12,16 @@ struct MyClass {
 };
 
 template<class CLASS>
-void mFunction(void (CLASS::* method)()) {}
+void mFunction(void (CLASS::* method)()) {} // { dg-message "candidate" }
 
 template<class CLASS>
-void cFunction(void (CLASS::* method)() const) {}
+void cFunction(void (CLASS::* method)() const) {} // { dg-message "candidate" }
 
 template<class CLASS>
-void vFunction(void (CLASS::* method)() volatile) {}
+void vFunction(void (CLASS::* method)() volatile) {} // { dg-message "candidate" }
 
 template<class CLASS>
-void cvFunction(void (CLASS::* method)() const volatile) {}
+void cvFunction(void (CLASS::* method)() const volatile) {} // { dg-message "candidate" }
 
 int main() {
   mFunction(&MyClass::mMethod);
index c8df94b31ca0ab38cea1793ec16c38a948041782..a49f5c1b2d0aef535136de8e8c1f9281239d70d1 100644 (file)
@@ -8,7 +8,7 @@ struct A
 
 template <typename S, typename T, typename U, typename S::v = &S::v::s>
 typename S::A
-foo (S c, T t, U u)
+foo (S c, T t, U u)            // { dg-message "candidate" }
 {
 }
 
index ee6a8ce0fdb41ab2327bcb8e2d198872210e6ac1..4e890fe50b3ed025189d2179b3b8635be2bd54cc 100644 (file)
@@ -8,7 +8,7 @@ template <typename T> void Foo1 (T const *a) {a (1);} // #2
 
 template <typename T> T const *Foo2 (T *);
 
-template <typename T> void Foo3 (T *, T const * = 0);
+template <typename T> void Foo3 (T *, T const * = 0); // { dg-message "candidate" }
 
 void Bar ()
 {
index 3f7028b642ffca10c9af95cf29942325110cda30..23f61f3dcca578a42099537cbcbf3902e8625c2d 100644 (file)
@@ -3,7 +3,7 @@
 
 // PR c++/3518
 template <typename T> void Foo (const T &);
-template <typename T> void Baz (const T (*)());
+template <typename T> void Baz (const T (*)()); // { dg-message "candidate" }
 
 int &f ();
 
index 2439efb761c65212160b3c65634e1d45ab68743f..1e16c432b8a8b416b4af188deed8a10f9c4a59bb 100644 (file)
@@ -4,7 +4,7 @@
 // Origin:Wolfgang Bangerth <bangerth@dealii.org>
 // PR 21799: deduction of cvqualifiers on member functions was wrong
 
-template <class T> void f (T &,       void (T::*)()      ); 
+template <class T> void f (T &,       void (T::*)()      ); // { dg-message "candidate" }
  
 struct X { 
     void g() const {}
index 0747fe995877b85f31dd36f3597a68f1a920bac8..c2c51c72173dca78a39b0b6cfe8f039f8235641e 100644 (file)
@@ -1,6 +1,6 @@
 // { dg-options "-w" }
 
-template<typename T> void foo(T);
+template<typename T> void foo(T); // { dg-message "candidate" }
  
 void bar()
 {
index 0932ca4665992c0bc36200d34029b1d936c7b27c..5dc1a87490309ee1074180fd547b3f613e5c529e 100644 (file)
@@ -292,7 +292,7 @@ SetLD<T>::contains(const T& item) const
 }
 template<class T>
 int
-operator==(const SetLD<T>& a, const SetLD<T>& b)
+operator==(const SetLD<T>& a, const SetLD<T>& b) // { dg-message "note" }
 {
     if (a.length() != b.length())
        return FALSE;
index 91de03ee8fcad41def085f3538f93cb018414a42..8d5372c6c3027238e799e468dc009983b7081257 100644 (file)
@@ -7,7 +7,7 @@
 //
 
 template <class T>
-void ffree(long rows, T** array)
+void ffree(long rows, T** array) // { dg-message "candidate" }
 {
 for( long i = 0; i < rows; i++ )
   delete [] array[i];                   // delete row
@@ -21,7 +21,7 @@ return array = new T[size];
 }
 
 template <class T>
-T** allocate2d(long d1, long d2, T**& array)
+T** allocate2d(long d1, long d2, T**& array) // { dg-message "note" }
 {
 if( allocate1d(d1, array) != 0 )
   {
index 09b5600c62d4a4de69a7ed7be8ae16fefcfd436b..23d0d2c76bd7bf1090f08fae2cfdc23e43344809 100644 (file)
@@ -2,7 +2,7 @@
 // { dg-options "" }
 
 template <class ARRY>
-inline unsigned int asize(ARRY &a)
+inline unsigned int asize(ARRY &a) // { dg-message "candidate" }
 {
   return sizeof(a) / sizeof(a[0]);
 }
index 60f5c4d8c6f74885fa4975bc2c7d09a254f50d5d..fb9ca3cf121e4e3651d76e0c67a60beba3c77a0f 100644 (file)
@@ -7,7 +7,7 @@
 template< typename SID, class SDR >
 void k( SID sid, SDR* p,
  void (SDR::*)
- ( typename SID::T ) );
+ ( typename SID::T ) );                // { dg-message "candidate" }
 
 struct E { };
 struct S { void f( int ); };
index e83898f2cc6fbf535c18c197d60e5345fb0f0676..35540240b93e1245d6d4d162286a0f13c290daf1 100644 (file)
@@ -1,6 +1,6 @@
 // { dg-do assemble  }
 template <int I>
-void f(int j);
+void f(int j);                 // { dg-message "candidate" }
 
 void g()
 {
index a765d7fafc3b72a832d6e7383f05c6cb29348d8c..70c72d003ed82540bb380a84aee914b7aa0e5978 100644 (file)
@@ -1,6 +1,6 @@
 // { dg-do assemble  }
 template <class T>
-void f(int i);
+void f(int i);                 // { dg-message "candidate" }
 
 void g()
 {
index b6a7747857ce0e06235d54c88f69eac2f06cfad8..e04e814dcaad75b61d83b460091cc0479650af32 100644 (file)
@@ -1,6 +1,6 @@
 // { dg-do assemble  }
 template <int I>
-void f(int i);
+void f(int i);                 // { dg-message "candidate" }
 
 void g()
 {
index f216a01416968d1b5f9952bc1a9436b2854ae03b..534309f0c986f5480160a97efe5959b9f3ab062c 100644 (file)
@@ -9,9 +9,9 @@ void g(int);
 void g(double);
 
 template <int* IP>
-void foo();
+void foo();                    // { dg-message "note" }
 template <long l>
-void foo();
+void foo();                    // { dg-message "note" }
 
 void bar()
 {
index 3e2ac1d76a912a56780cd39588660e811f205baa..0df1f46dbdcac5ab798052267a01f222a674ca35 100644 (file)
@@ -7,7 +7,7 @@ template <int I, int J>
 struct S<I, J, 2> : public S<I, I, I>, S<J, J, J> {};
 
 template <int I, int J, int K>
-void f(S<I, J, K>, S<I, I, I>);
+void f(S<I, J, K>, S<I, I, I>);        // { dg-message "candidate" }
 
 void g() {
   S<0, 0, 0> s0;
index 22ee4c8b16ae6f7a4ddae79eff3e8761f7800421..881b906704b182c4c12e82b69ca000ea3570636c 100644 (file)
@@ -4,7 +4,7 @@ template <int I>
 struct S {};
 
 template <int J>
-void foo(S<J + 2>);
+void foo(S<J + 2>);            // { dg-message "candidate" }
 
 void bar()
 {
index 827e3d80a7c906dede583b9f60ee134586d9f711..6f5dff0a2ffd1392e47407d513c2d6c4574dbdee 100644 (file)
@@ -1,4 +1,5 @@
 // { dg-do assemble  }
+// { dg-prune-output "note" }
 
 // Adapted from testcase by Corey Kosak <kosak@cs.cmu.edu>
 
index 4c98b3df19df6d4c27960568d1b7386aa929f9ab..51c5536c7d104f47f767e766d77208a89204e61c 100644 (file)
@@ -13,9 +13,9 @@ public:
 };
 
 template <void (A::*)() >
-void g() {}
+void g() {}                    // { dg-message "candidate" }
 template <int A::*>
-void h() {}
+void h() {}                    // { dg-message "candidate" }
 
 
 int main() {
index 821880cc3a0d39bdc05a80ef85956cb6eb953480..9aee75fdb21a9f3710988b162d78d1460c14f482 100644 (file)
@@ -1,13 +1,13 @@
 // { dg-do assemble  }
 
 template <class T>
-void f(T t1, T t2);
+void f(T t1, T t2);            // { dg-message "candidate" }
 
 template <>
 void f(int i, int j);
 
 template <class T>
-void g(T t1, T t2) {}
+void g(T t1, T t2) {}          // { dg-message "candidate" }
 
 template void g(int i, int j);
 
index 276e398262e0511c9ca3d2220152a8d5378233e2..765dd8e7583bc6910b5215c3ca6f70633036f355 100644 (file)
@@ -3,7 +3,7 @@
 struct S1
 {
   template <class T>
-  void f(T t1, T t2);
+  void f(T t1, T t2);          // { dg-message "candidate" }
 };
 
 
@@ -14,7 +14,7 @@ template <class U>
 struct S2
 {
   template <class T>
-  void f(T t1, T t2);
+  void f(T t1, T t2);          // { dg-message "candidate" }
 };
 
 template <>
index c2c271993912b1c56aae6c09baecfeedd471f25a..fe6281b9ca2b4cc3f295041889087ef8522c417c 100644 (file)
@@ -1,7 +1,7 @@
 // { dg-do assemble  }
 // { dg-options "" }
 
-template <class X> int f (X x, X y) { return 23; }
+template <class X> int f (X x, X y) { return 23; } // { dg-message "candidate" }
 
 int foo () {
   return f (7);        // { dg-error "" } 
index e4129eae96c7e67e74279d7b234afa5020c424bb..51bfaf48775628c498bd00dc159befce7ee3447b 100644 (file)
@@ -1,5 +1,5 @@
 // { dg-do assemble  }
-template <class T> void f (T);
+template <class T> void f (T); // { dg-message "candidate" }
 
 void g ();
 void g (int);
index feac3f7d95fa6f8031555c0485649781980bc6ca..18a0553133dc0f671b9acfad59e7682970bcbc90 100644 (file)
@@ -19,7 +19,7 @@ template<> void fn<int &>() {} // ok, specialize A
 template<> void fn<void ()>() {} // ok, specialize A
 
 // now make sure we moan when we really should
-template<class T> void foo(T const *){}
+template<class T> void foo(T const *){} // { dg-message "candidate" }
 
 void f()
 {
index 92cd191deb0b1ad7581074a42caf199a94fb2b13..a0cb738956d5a66e7f17aced002efb24ca08eb29 100644 (file)
@@ -8,9 +8,9 @@
 // overload resolution.
 
 
-template <typename T> void Foo (T const **);
+template <typename T> void Foo (T const **); // { dg-message "candidate" }
 template <typename T> void Bar (T const * const *);
-void Foo (int);       // { dg-message "candidate" } 
+void Foo (int);       // { dg-message "note" }
 void Foo (float);     // { dg-message "note" } candidate
 
 void baz (int **p1)
index d011ae1c95336970b9a2d570c96506d8bf450cc3..bb8892c7f610eb830e95b1a11dcd557dbaa15f5f 100644 (file)
@@ -1,6 +1,6 @@
 // { dg-do assemble  }
 template<bool B>
-void f()
+void f()                       // { dg-message "candidate" }
 {
 }
 
index 8d1c94d168ffcb732fecff0e86a2b6c26eddb3b4..1c1ad3e306779b6be639c2512973e595dbc0a3cb 100644 (file)
@@ -1,4 +1,5 @@
 // { dg-do assemble  }
+// { dg-prune-output "note" }
 // Makes bogus x86 assembly code.
 #include <iostream>
 
index 68404fe13fe662f4d1715d13f3355880251f7fc3..5fb4861a3a4851009b59c9727f0e30fa814a8609 100644 (file)
@@ -5,7 +5,7 @@
     template<class T, unsigned int Length>
     inline
     unsigned int
-    extent(T (&x)[Length])
+    extent(T (&x)[Length])     // { dg-message "candidate" }
     {
             return Length;
     }
index 903f371fa626026d574ed5b246f1b44509d114ab..ae20b119cf43f1f3343aa01b538616ae6307a611 100644 (file)
@@ -1,3 +1,10 @@
+2010-05-12  Jason Merrill  <jason@redhat.com>
+
+       * testsuite/20_util/auto_ptr/assign_neg.cc: Expect template
+       candidate messages.
+       * testsuite/20_util/unique_ptr/assign/assign_neg.cc: Likewise.
+       * testsuite/20_util/weak_ptr/comparison/cmp_neg.cc: Likewise.
+
 2010-05-11  Silvius Rus  <silvius.rus@gmail.com>
 
        PR libstdc++/43259
index b4b9eb910a68000c6f6ef9bba67625c69960a2fc..1f6e67394e90004e63bd0b90e5258986b67657df 100644 (file)
@@ -47,4 +47,5 @@ main()
   return 0;
 }
 // { dg-error "candidates" "" { target *-*-* } 134 } 
+// { dg-error "note" "" { target *-*-* } 152 }
 // { dg-error "::auto_ptr" "" { target *-*-* } 262 } 
index 525364b341215e68c7d06fb92a4d71557d21ed22..4aa93b91d9135e3278064f54f06e91b5a4c8d8bb 100644 (file)
@@ -52,7 +52,8 @@ test03()
 // { dg-error "deleted function" "" { target *-*-* } 357 }
 // { dg-error "used here" "" { target *-*-* } 42 }
 // { dg-error "no matching" "" { target *-*-* } 48 }
-// { dg-warning "candidates are" "" { target *-*-* } 130 }
+// { dg-warning "note" "" { target *-*-* } 130 }
+// { dg-warning "note" "" { target *-*-* } 134 }
 // { dg-warning "note" "" { target *-*-* } 123 }
 // { dg-warning "note" "" { target *-*-* } 118 }
 // { dg-warning "note" "" { target *-*-* } 113 }
index 93aceb305eb9807a2a629e3bd5711152a88bc99b..6165db09df7ea3d8eb9af016cbc858b60518889c 100644 (file)
@@ -40,3 +40,12 @@ main()
   test01();
   return 0;
 }
+
+// { dg-warning "note" "" { target *-*-* } 281 }
+// { dg-warning "note" "" { target *-*-* } 407 }
+// { dg-warning "note" "" { target *-*-* } 831 }
+// { dg-warning "note" "" { target *-*-* } 511 }
+// { dg-warning "note" "" { target *-*-* } 1005 }
+// { dg-warning "note" "" { target *-*-* } 340 }
+// { dg-warning "note" "" { target *-*-* } 290 }
+// { dg-warning "note" "" { target *-*-* } 190 }