1139823Simp// { dg-do assemble  }
275374Sbp// 980604 bkoz
375374Sbp// 3.4.5 Class member access p 4
475374Sbp// nested and non-nested calls, no dtors
575374Sbp
675374Sbpstruct L {
775374Sbp  int ii;
875374Sbp  void foo(int a) {++a;}
975374Sbp  struct Linner {
1075374Sbp    int ii_inner;
1175374Sbp    void foo_inner(int b) {++b;}
1275374Sbp  };
1375374Sbp};
1475374Sbpclass A : public L {};
1575374Sbpclass B : public L {};
1675374Sbpclass C : public A, public B {};
1775374Sbp
1875374Sbp
1975374Sbpvoid foo() {
2075374Sbp  // straight call
2175374Sbp  C x;
2275374Sbp  x.A::ii = 5;
2375374Sbp  x.A::foo(x.A::ii);
2475374Sbp
2575374Sbp  // 5.1 Primary expressions
2675374Sbp  // p 8
2775374Sbp  // a nested name specifier that names a class,
2875374Sbp  // optionally followed by the keyword template and then followd by
2975374Sbp  // the name of a member of either that class or one of its base
3075374Sbp  // classes is a qualified-id.  (3.4.3.1 describes their lookup.)
3175475Sbp
3275475Sbp  // 5.2.5 Class memember access
3375475Sbp
3475475Sbp  // p 3 if E1 has the type 'pointer to class X' then
3575475Sbp  // E1->E2 == (*(E1)).E32
3675430Sbp  // E1 == object-expression
3775430Sbp  // E2 == id-expression
3875374Sbp  // thus everything gets converted to the "." notation
3975374Sbp
4075374Sbp  // p 2
4175374Sbp  // the id-expression shall name a member of the class
4275374Sbp  // (object-expression) or of one of its base classes.
4375374Sbp
4475374Sbp  // p4 if E2 is a nested type (of the object-expression), tye
4575374Sbp  // expression E1.E2 is ill formed.
4675374Sbp
4775374Sbp  // try 1 nested call - ERROR
4875475Sbp#if 0
4975374Sbp  C x2;
5075374Sbp  x2.A::L::Linner::ii_inner = 6; //ERROR violates p2, does not name member of C
5175374Sbp  x2.A::L::Linner::foo_inner(x2.A::L::Linner::ii_inner);
5275374Sbp#endif
5375374Sbp
5475374Sbp  //try2: scoped method call  -edg +acc +g++
5575374Sbp#if 1
5675374Sbp  C::A::Linner x2;
5775374Sbp  x2.A::Linner::ii_inner = 6;
5875374Sbp  x2.A::Linner::foo_inner(x2.A::Linner::ii_inner);
5975374Sbp#endif
6075374Sbp
61217174Scsjp  //try 3: non-scoped method call  -edg +acc +g++
6275374Sbp#if 0
63217174Scsjp  C::A::L::Linner x3;
6475374Sbp  x3.ii_inner = 6;
6575374Sbp  x3.foo_inner(x3.ii_inner);
6675374Sbp#endif
6775374Sbp}
6875374Sbp
6975374Sbp
7075374Sbp
7175374Sbp
7275374Sbp