Home | History | Annotate | Download | only in SemaCXX
      1 // RUN: %clang_cc1 -fsyntax-only -verify %s
      2 
      3 class X {};
      4 
      5 void test() {
      6   X x;
      7 
      8   x.int; // expected-error{{expected unqualified-id}}
      9   x.~int(); // expected-error{{expected a class name}}
     10   x.operator; // expected-error{{expected a type}}
     11   x.operator typedef; // expected-error{{expected a type}} expected-error{{type name does not allow storage class}}
     12 }
     13 
     14 void test2() {
     15   X *x;
     16 
     17   x->int; // expected-error{{expected unqualified-id}}
     18   x->~int(); // expected-error{{expected a class name}}
     19   x->operator; // expected-error{{expected a type}}
     20   x->operator typedef; // expected-error{{expected a type}} expected-error{{type name does not allow storage class}}
     21 }
     22 
     23 // PR6327
     24 namespace test3 {
     25   template <class A, class B> struct pair {};
     26 
     27   void test0() {
     28     pair<int, int> z = minmax({}); // expected-error {{expected expression}}
     29   }
     30 
     31   struct string {
     32     class iterator {};
     33   };
     34 
     35   void test1() {
     36     string s;
     37     string::iterator i = s.foo(); // expected-error {{no member named 'foo'}}
     38   }
     39 }
     40 
     41 
     42 // Make sure we don't crash.
     43 namespace rdar11293995 {
     44 
     45 struct Length {
     46   explicit Length(PassRefPtr<CalculationValue>); // expected-error {{unknown type name}} \
     47                     expected-error {{expected ')'}} \
     48                     expected-note {{to match this '('}}
     49 };
     50 
     51 struct LengthSize {
     52     Length m_width;
     53     Length m_height;
     54 };
     55 
     56 enum EFillSizeType { Contain, Cover, SizeLength, SizeNone };
     57 
     58 struct FillSize {
     59     EFillSizeType type;
     60     LengthSize size;
     61 };
     62 
     63 class FillLayer {
     64 public:
     65     void setSize(FillSize f) { m_sizeType = f.type;}
     66 private:
     67     unsigned m_sizeType : 2;
     68 };
     69 
     70 }
     71