This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Testcase for fixed PR c++/2437
- From: Nathanael Nerode <neroden at twcny dot rr dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Thu, 2 Jan 2003 21:09:49 -0500
- Subject: Testcase for fixed PR c++/2437
Applied.
* g++.dg/lookup/two-stage1.C: New test.
Index: g++.dg/lookup/two-stage1.C
===================================================================
RCS file: g++.dg/lookup/two-stage1.C
diff -N g++.dg/lookup/two-stage1.C
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ g++.dg/lookup/two-stage1.C 3 Jan 2003 02:10:03 -0000
@@ -0,0 +1,18 @@
+/* PR c++/2437 */
+/* { dg-do run } */
+
+// Test of two-stage name lookup.
+
+int g(double) { return 0; }
+
+template <class T> struct X
+{
+ int f() { return g(2); } // should call g(double)
+};
+
+inline int g(int) { return 1; }
+
+int main()
+{
+ return X<int>().f(); // should call g(double), but used to call g(int)
+}