OSDN Git Service

* gcc.dg/20020201-1.c: Use cleanup-coverage_files.
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / g++.old-deja / g++.law / arm9.C
1 // { dg-do assemble  }
2 // GROUPS passed ARM-compliance
3 #include        <iostream>
4 enum f1 {
5      F1
6 };
7
8 enum f2 {
9     F2
10 };
11
12 class A {
13 public:
14     void set (f1 f);
15 };
16 void A::set (f1 f) { std::cout << "called A f1\n";}
17
18 class B : public A {
19 public:
20     void set (f2 f);
21 };
22 void B::set (f2 f) { std::cout << "called B\n";} // { dg-error "" } candidate
23
24 int main() {
25     B b;
26     b.set(F1); // ARM page 309: should call A.set(f1) and that what g++ does,// { dg-error "" } .*
27                // but 13.1 of ARM clearly states that it should call B::set()
28                // or generate an error because overloading works only for
29                // functions within the same scope (first page of chapter 13)
30                // while member of derived and base classes are considered to
31                // belong to different scopes.  Thus B::set() should have
32                // hidden (completely) the A::set() function.
33 }
34
35
36
37
38