blob: 392ddddcb4ef7f605ab59ccf5f05264c1f3b4bb4 [file] [log] [blame]
Richard Smith58bd01f2019-01-16 22:01:39 +00001// RUN: %clang_cc1 -std=c++11 -verify %s
2
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 shortcircuit
16 // 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}