| 1 |
// { dg-do assemble } |
| 2 |
// { dg-skip-if "requires hosted libstdc++ for iostream" { ! hostedlib } } |
| 3 |
// GROUPS passed ARM-compliance |
| 4 |
#include <iostream> |
| 5 |
enum f1 { |
| 6 |
F1 |
| 7 |
}; |
| 8 |
|
| 9 |
enum f2 { |
| 10 |
F2 |
| 11 |
}; |
| 12 |
|
| 13 |
class A { |
| 14 |
public: |
| 15 |
void set (f1 f); |
| 16 |
}; |
| 17 |
void A::set (f1 f) { std::cout << "called A f1\n";} |
| 18 |
|
| 19 |
class B : public A { |
| 20 |
public: |
| 21 |
void set (f2 f); |
| 22 |
}; |
| 23 |
void B::set (f2 f) { std::cout << "called B\n|no known conversion";} // { dg-message "B::set|no known conversion" } |
| 24 |
|
| 25 |
int main() { |
| 26 |
B b; |
| 27 |
b.set(F1); // ARM page 309: should call A.set(f1) and that what g++ does,// { dg-error "cannot convert" } |
| 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. |
| 34 |
} |
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
|