]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/38030 (name-lookup for non-dependent name in template function is wrong)
authorJason Merrill <jason@gcc.gnu.org>
Fri, 14 Nov 2008 23:06:11 +0000 (18:06 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Fri, 14 Nov 2008 23:06:11 +0000 (18:06 -0500)
        PR c++/38030
        * semantics.c (finish_call_expr): Don't repeat arg-dep lookup
        for a non-dependent call.

From-SVN: r141872

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

index 96084a112427c92d73d5e5cc6d1eb8997b6770f8..36135eb6554e743007d40d05ca967ebbcee627b0 100644 (file)
@@ -1,3 +1,15 @@
+<<<<<<< .working
+=======
+2008-11-14  Jason Merrill  <jason@redhat.com>
+
+       PR c++/38030
+       * semantics.c (finish_call_expr): Don't repeat arg-dep lookup
+       for a non-dependent call.
+
+       PR c++/37740
+       * call.c (build_aggr_conv): Increment i.
+
+>>>>>>> .merge-right.r141866
 2008-11-13  Jason Merrill  <jason@redhat.com>
 
        PR c++/37932
index 5886972f9fd3c5b7cff79d371a8e58c11265f386..d95d731e6fd66192ebf63423868e7dbfdb4e380d 100644 (file)
@@ -1886,7 +1886,9 @@ finish_call_expr (tree fn, tree args, bool disallow_virtual, bool koenig_p)
     {
       result = build3 (CALL_EXPR, TREE_TYPE (result), orig_fn,
                       orig_args, NULL_TREE);
-      KOENIG_LOOKUP_P (result) = koenig_p;
+      /* Don't repeat arg-dependent lookup at instantiation time if this call
+         is not type-dependent.  */
+      KOENIG_LOOKUP_P (result) = 0;
     }
   return result;
 }
index d61c2b1d74cc5c181e52a3509e0508a6e42f4b8b..c849d0a1a5b22388581f0d7c5842d7f42c61a316 100644 (file)
@@ -1,7 +1,15 @@
 2008-11-13  Uros Bizjak  <ubizjak@gmail.com>
 
+<<<<<<< .working
        Backport from mainline:
        2008-06-06  Uros Bizjak <ubizjak@gmail.com>
+=======
+       PR c++/38030
+       * g++.dg/template/lookup8.C: New test.
+
+       PR c++/37740
+       * g++.dg/cpp0x/initlist8.C: New test.
+>>>>>>> .merge-right.r141866
 
        PR rtl-optimization/36438
        * gcc.target/i386/pr36438.c
diff --git a/gcc/testsuite/g++.dg/template/lookup8.C b/gcc/testsuite/g++.dg/template/lookup8.C
new file mode 100644 (file)
index 0000000..981c283
--- /dev/null
@@ -0,0 +1,19 @@
+// PR c++/38030
+// The call to f should be resolved at template definition time.
+// { dg-do link }
+
+struct B { };
+struct D : public B { };
+D d;
+void f (B &) { }
+template < class T >
+void g ()
+{
+  return f (d);
+}
+void f (D &);
+int main ()
+{
+  g<int> ();
+  return 0;
+}