aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/cp/ChangeLog4
-rw-r--r--gcc/cp/semantics.c4
-rw-r--r--gcc/testsuite/ChangeLog3
-rw-r--r--gcc/testsuite/g++.dg/template/lookup8.C19
4 files changed, 29 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index fd610b1..a4dbc86 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,9 @@
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.
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index 664f36d4..e0ae6ff 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -1976,7 +1976,9 @@ finish_call_expr (tree fn, tree args, bool disallow_virtual, bool koenig_p,
if (processing_template_decl)
{
result = build_call_list (TREE_TYPE (result), orig_fn, orig_args);
- 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;
}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 6e86c2e..2c74349 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,8 @@
2008-11-14 Jason Merrill <jason@redhat.com>
+ PR c++/38030
+ * g++.dg/template/lookup8.C: New test.
+
PR c++/37740
* g++.dg/cpp0x/initlist8.C: New test.
diff --git a/gcc/testsuite/g++.dg/template/lookup8.C b/gcc/testsuite/g++.dg/template/lookup8.C
new file mode 100644
index 0000000..981c283e
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/lookup8.C
@@ -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;
+}