Merge from mainline (167278:168000).
[official-gcc/graphite-test-results.git] / gcc / testsuite / g++.old-deja / g++.law / arm9.C
blob979ef808820eaafc00d319ef273b59c02ed99131
1 // { dg-do assemble  }
2 // GROUPS passed ARM-compliance
3 #include        <iostream>
4 enum f1 {
5      F1
6 };
8 enum f2 {
9     F2
12 class A {
13 public:
14     void set (f1 f);
16 void A::set (f1 f) { std::cout << "called A f1\n";}
18 class B : public A {
19 public:
20     void set (f2 f);
22 void B::set (f2 f) { std::cout << "called B\n|no known conversion";} // { dg-message "B::set|no known conversion" }
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 "match" }
27     // { dg-message "candidate" "candidate note" { target *-*-* } 26 }
28                // but 13.1 of ARM clearly states that it should call B::set()
29                // or generate an error because overloading works only for
30                // functions within the same scope (first page of chapter 13)
31                // while member of derived and base classes are considered to
32                // belong to different scopes.  Thus B::set() should have
33                // hidden (completely) the A::set() function.