blob: 87da79a27c0cbd1d372c0f21c1ecc572f7777734 [file] [log] [blame]
Daniel Dunbara5728872009-12-15 20:14:24 +00001// RUN: %clang_cc1 -fsyntax-only -verify %s
Douglas Gregora6f0f9d2009-08-31 19:52:13 +00002
3class X {};
4
5void test() {
6 X x;
7
Douglas Gregor2d1c2142009-11-03 19:44:04 +00008 x.int; // expected-error{{expected unqualified-id}}
Douglas Gregor124b8782010-02-16 19:09:40 +00009 x.~int(); // expected-error{{expected a class name}}
Nick Lewycky9fa8e562010-11-03 17:52:57 +000010 x.operator; // expected-error{{expected a type}}
Richard Smith69730c12012-03-12 07:56:15 +000011 x.operator typedef; // expected-error{{expected a type}} expected-error{{type name does not allow storage class}}
Douglas Gregora6f0f9d2009-08-31 19:52:13 +000012}
13
14void test2() {
15 X *x;
16
Douglas Gregor2d1c2142009-11-03 19:44:04 +000017 x->int; // expected-error{{expected unqualified-id}}
Douglas Gregor124b8782010-02-16 19:09:40 +000018 x->~int(); // expected-error{{expected a class name}}
Nick Lewycky9fa8e562010-11-03 17:52:57 +000019 x->operator; // expected-error{{expected a type}}
Richard Smith69730c12012-03-12 07:56:15 +000020 x->operator typedef; // expected-error{{expected a type}} expected-error{{type name does not allow storage class}}
Douglas Gregora6f0f9d2009-08-31 19:52:13 +000021}
John McCall7727acf2010-03-31 02:13:20 +000022
23// PR6327
24namespace 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 Kyrtzidisd601c622012-04-27 04:31:46 +000040
41
42// Make sure we don't crash.
43namespace rdar11293995 {
44
45struct Length {
46 explicit Length(PassRefPtr<CalculationValue>); // expected-error {{unknown type name}} \
47 expected-error {{expected ')'}} \
48 expected-note {{to match this '('}}
49};
50
51struct LengthSize {
52 Length m_width;
53 Length m_height;
54};
55
56enum EFillSizeType { Contain, Cover, SizeLength, SizeNone };
57
58struct FillSize {
59 EFillSizeType type;
60 LengthSize size;
61};
62
63class FillLayer {
64public:
65 void setSize(FillSize f) { m_sizeType = f.type;}
66private:
67 unsigned m_sizeType : 2;
68};
69
70}