1 // RUN: %clang_cc1 -fsyntax-only -verify %s
2 // RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s
3 // RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
4 
5 class X {};
6 
test()7 void test() {
8   X x;
9 
10   x.int; // expected-error{{expected unqualified-id}}
11   x.~int(); // expected-error{{expected a class name}}
12   x.operator; // expected-error{{expected a type}}
13   x.operator typedef; // expected-error{{expected a type}} expected-error{{type name does not allow storage class}}
14 }
15 
test2()16 void test2() {
17   X *x;
18 
19   x->int; // expected-error{{expected unqualified-id}}
20   x->~int(); // expected-error{{expected a class name}}
21   x->operator; // expected-error{{expected a type}}
22   x->operator typedef; // expected-error{{expected a type}} expected-error{{type name does not allow storage class}}
23 }
24 
25 // PR6327
26 namespace test3 {
27   template <class A, class B> struct pair {};
28   template <class _E> class initializer_list {};
minmax(initializer_list<_Tp> __l)29   template <typename _Tp> pair<_Tp, _Tp> minmax(initializer_list<_Tp> __l) {};
30 
test0()31   void test0() {
32     pair<int, int> z = minmax({});
33 #if __cplusplus <= 199711L // C++03 or earlier modes
34     // expected-error@-2 {{expected expression}}
35 #else
36     // expected-error@-4 {{no matching function for call to 'minmax'}}
37     // expected-note@-8 {{candidate template ignored: couldn't infer template argument '_Tp'}}
38 #endif
39   }
40 
41   struct string {
42     class iterator {};
43   };
44 
test1()45   void test1() {
46     string s;
47     string::iterator i = s.foo(); // expected-error {{no member named 'foo'}}
48   }
49 }
50 
51 
52 // Make sure we don't crash.
53 namespace rdar11293995 {
54 
55 struct Length {
56   explicit Length(PassRefPtr<CalculationValue>); // expected-error {{unknown type name}} \
57                     expected-error {{expected ')'}} \
58                     expected-note {{to match this '('}}
59 };
60 
61 struct LengthSize {
62     Length m_width;
63     Length m_height;
64 };
65 
66 enum EFillSizeType { Contain, Cover, SizeLength, SizeNone };
67 
68 struct FillSize {
69     EFillSizeType type;
70     LengthSize size;
71 };
72 
73 class FillLayer {
74 public:
setSize(FillSize f)75     void setSize(FillSize f) { m_sizeType = f.type;}
76 private:
77     unsigned m_sizeType : 2;
78 };
79 
80 }
81