g++.dg/lookup/template1.C: New test.
authorNathanael Nerode <neroden@gcc.gnu.org>
Wed, 1 Jan 2003 20:36:49 +0000 (20:36 +0000)
committerNathanael Nerode <neroden@gcc.gnu.org>
Wed, 1 Jan 2003 20:36:49 +0000 (20:36 +0000)
From-SVN: r60761

gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/lookup/template1.C [new file with mode: 0644]

index 7ea5b6f64c49cf91c94e243fdc42a3c03247417b..a9fff0808652bb230522e602f95c01fc15171c6f 100644 (file)
@@ -1,5 +1,7 @@
 2003-01-01  Nathanael Nerode  <neroden@gcc.gnu.org>
 
+       g++.dg/lookup/template1.C: New test.
+
        g++.dg/parse/namespace2.C: New test.
 
        g++.dg/parse/parens2.C: New test.
diff --git a/gcc/testsuite/g++.dg/lookup/template1.C b/gcc/testsuite/g++.dg/lookup/template1.C
new file mode 100644 (file)
index 0000000..44b599a
--- /dev/null
@@ -0,0 +1,23 @@
+/* PR c++/3009 */
+/* { dg-do run } */
+// According to 14.6.2.4 of C++ Standard:
+// "If a base class is a dependent type, a member of that
+// class cannot hide a name declared within a template, or a
+// name from the template's enclosing scopes."
+class B {
+public:
+  int foo() { return 1; }
+};
+int foo() { return 0; }
+template <class T> class C : public T {
+public:
+  int caller() { return foo(); } // This must be ::foo, not B::foo.
+};
+
+int main() {
+  C<B> c;
+  return c.caller(); // Returns 1 if we got the wrong one.
+}