Bug 52766 - unambiguous member lookup rejected
Summary: unambiguous member lookup rejected
Status: RESOLVED INVALID
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.8.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-03-29 09:12 UTC by chrbr
Modified: 2012-03-29 10:45 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description chrbr 2012-03-29 09:12:20 UTC
The following code (from 3.4.5-4 - class member access) is rejected:

struct A { int a; };

struct B: virtual A { };

struct C: B { };

struct D: B { };

struct E : public C, public D { };

void f()
{
  E e;
  e.B::a = 0;
}


f1.cxx: In function 'void f()':
f1.cxx:25:8: error: 'B' is an ambiguous base of 'E'

According to 10.2.5 (Member name lookup), member access e.B::a = 0 is OK because there is only one "a" (virtual)
Comment 1 Jonathan Wakely 2012-03-29 10:28:55 UTC
The example was wrong and is not in C++11

http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#381
Comment 2 chrbr 2012-03-29 10:45:26 UTC
Thanks