Daniel Dunbar | a572887 | 2009-12-15 20:14:24 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only -verify %s |
Douglas Gregor | a6f0f9d | 2009-08-31 19:52:13 +0000 | [diff] [blame] | 2 | |
| 3 | class X {}; |
| 4 | |
| 5 | void test() { |
| 6 | X x; |
| 7 | |
Douglas Gregor | 2d1c214 | 2009-11-03 19:44:04 +0000 | [diff] [blame] | 8 | x.int; // expected-error{{expected unqualified-id}} |
Douglas Gregor | 124b878 | 2010-02-16 19:09:40 +0000 | [diff] [blame] | 9 | x.~int(); // expected-error{{expected a class name}} |
Nick Lewycky | 9fa8e56 | 2010-11-03 17:52:57 +0000 | [diff] [blame] | 10 | x.operator; // expected-error{{expected a type}} |
Richard Smith | 69730c1 | 2012-03-12 07:56:15 +0000 | [diff] [blame] | 11 | x.operator typedef; // expected-error{{expected a type}} expected-error{{type name does not allow storage class}} |
Douglas Gregor | a6f0f9d | 2009-08-31 19:52:13 +0000 | [diff] [blame] | 12 | } |
| 13 | |
| 14 | void test2() { |
| 15 | X *x; |
| 16 | |
Douglas Gregor | 2d1c214 | 2009-11-03 19:44:04 +0000 | [diff] [blame] | 17 | x->int; // expected-error{{expected unqualified-id}} |
Douglas Gregor | 124b878 | 2010-02-16 19:09:40 +0000 | [diff] [blame] | 18 | x->~int(); // expected-error{{expected a class name}} |
Nick Lewycky | 9fa8e56 | 2010-11-03 17:52:57 +0000 | [diff] [blame] | 19 | x->operator; // expected-error{{expected a type}} |
Richard Smith | 69730c1 | 2012-03-12 07:56:15 +0000 | [diff] [blame] | 20 | x->operator typedef; // expected-error{{expected a type}} expected-error{{type name does not allow storage class}} |
Douglas Gregor | a6f0f9d | 2009-08-31 19:52:13 +0000 | [diff] [blame] | 21 | } |
John McCall | 7727acf | 2010-03-31 02:13:20 +0000 | [diff] [blame] | 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 | } |
Argyrios Kyrtzidis | d601c62 | 2012-04-27 04:31:46 +0000 | [diff] [blame] | 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 | } |