brintos

brintos / llvm-project-archived public Read only

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