g++ fails on qualified name in multiple inheritance

Bug #424838 reported by Michael Tsang
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
gcc
Fix Released
Low
gcc-4.4 (Ubuntu)
Incomplete
Undecided
Unassigned

Bug Description

struct base{
        int x;
        base():x(){}
        virtual~base(){}
};

struct aa:public base{
};

struct ab:public base{
};

struct ba:public aa,ab{
};

struct bb:public aa,ab{
};

struct final:public ba,bb{
};

int main(){
        final obj;
        obj.ba::aa::x=5;
}

/*
Expected behaviour:
The member x accessed by the path final::ba::aa::x in main()::obj is changed to 5

Actual behaviour:
g++ fails to compile this program generating:
test.cpp: In function ‘int main()’:
test.cpp:24: error: ‘aa’ is an ambiguous base of ‘final’
*/

Revision history for this message
Matthias Klose (doko) wrote :

See the upstream bug report, this is intended behaviour afaics.

Changed in gcc-4.4 (Ubuntu):
status: New → Incomplete
Revision history for this message
Michael Tsang (miklcct) wrote : Re: [Bug 424838] Re: g++ fails on qualified name in multiple inheritance

On Saturday 12 September 2009 21:48:47 Matthias Klose wrote:
> See the upstream bug report, this is intended behaviour afaics.
>
>
> ** Bug watch added: GCC Bugzilla #16889
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16889
>
> ** Also affects: gcc via
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16889
> Importance: Unknown
> Status: Unknown
>
> ** Changed in: gcc-4.4 (Ubuntu)
> Status: New => Incomplete
>

However, the problem is not the same as the upstream report.
If we comment out the line b.f(); , the code compiles.
The upstream report is about member selection without the FQN but in my
program, it even generate errors with the FQN.

Changed in gcc:
status: Unknown → Fix Released
Changed in gcc:
importance: Unknown → Low
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.