This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/13590] [DR39] Non-existing ambiguity when inheriting through virtuals two identical using declarations.


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=13590

darkdragon-001 at web dot de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |darkdragon-001 at web dot de

--- Comment #20 from darkdragon-001 at web dot de ---
I think that non abiguous cases should be allowed. My basic inheritance
structure is as follows:

01 class Base {
02     public:
03        virtual void foo() { cout << "Base" << endl; }
04 };
05 class A : public Base {
06    public:
07        //using Base::foo;
08        //virtual void foo() { cout << "A" << endl; }
09        //virtual void foo() { Base::foo(); }
10 };
11 class B : public Base {
12    public:
13        //virtual void foo() { cout << "B" << endl; }
14 };
15 class AB : public A,B {
16    public:
17         //using Base::foo;
18        //using A::foo;
19        //using A::Base::foo;
20        //virtual void foo() { cout << "AB" << endl; }
21 };
22 
23 int main() {
24     //Base *p = new AB;
25     AB *p = new AB;
26     //p->foo();
27 
28     return 0;
29 }

Currently only the following case is possible:
0.) uncomment line 09, 18, 26 which is the worst option I think

The following cases should be allowed:
1.) uncomment line 24 // virtual and non virtual functions are unambiguous
2.) uncomment line 26 // it is clear to use HW::foo() -> both paths same
properties
3.) uncomment line 17 // clear to use HW::foo()
4.) uncomment line 18 (perhaps together with line 07) // clear to use the
inherited A::foo() which inherits from the HW::foo()
5.) change line 11 to "class B : private Base {" // only A::foo is accessible,
B::foo not
6.) doing the the cases above without virtual


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]