brintos

brintos / llvm-project-archived public Read only

0
0
Text · 725 B · d204dbf Raw
32 lines · cpp
1// RUN: %clang_cc1 -std=c++11 -verify %s2 3namespace PR40329 {4  struct A {5    A(int);6    friend int operator->*(A, A);7  };8  struct B : A {9    B();10    enum E { e };11  };12  // Associated classes for B are {B, A}13  // Associated classes for B::E are {B} (non-transitive in this case)14  //15  // If we search B::E first, we must not mark B "visited" and shortcircuit16  // visiting it later, or we won't find the associated class A.17  int k0 = B::e ->* B::e; // expected-error {{non-pointer-to-member type}}18  int k1 = B::e ->* B();19  int k2 = B() ->* B::e;20}21 22namespace ForwardDecl {23  struct A {24    friend class B;25  };26  struct B {27    enum E { X };28    friend E operator|(E, E);29    void g() { operator|(X, X); }30  };31}32