blob: 4aa309846101e6dc274f0bcab19298a82a6784df [file] [log] [blame]
Sebastian Redlf30208a2009-01-24 21:16:55 +00001// RUN: clang -fsyntax-only -verify %s
2
3struct A {};
4enum B { Dummy };
5namespace C {}
Sebastian Redl4433aaf2009-01-25 19:43:20 +00006struct D : A {};
Sebastian Redlf30208a2009-01-24 21:16:55 +00007
8int A::*pdi1;
9int (::A::*pdi2);
10int (A::*pfi)(int);
11
12int B::*pbi; // expected-error {{expected a class or namespace}}
13int C::*pci; // expected-error {{'pci' does not point into a class}}
14void A::*pdv; // expected-error {{'pdv' declared as a member pointer to void}}
15int& A::*pdr; // expected-error {{'pdr' declared as a pointer to a reference}}
Sebastian Redl8edef7c2009-01-24 23:29:36 +000016
17void f() {
18 // This requires tentative parsing.
19 int (A::*pf)(int, int);
Sebastian Redl4433aaf2009-01-25 19:43:20 +000020
21 // Implicit conversion to bool.
22 bool b = pdi1;
23 b = pfi;
24
25 // Conversion from null pointer constant.
26 pf = 0;
27 pf = __null;
28
29 // Conversion to member of derived.
30 int D::*pdid = pdi1;
31 pdid = pdi2;
Sebastian Redl8edef7c2009-01-24 23:29:36 +000032}