diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/CodeGen/object-size.c | 19 | ||||
-rw-r--r-- | test/Parser/cxx1z-fold-expressions.cpp | 9 | ||||
-rw-r--r-- | test/Sema/builtin-object-size.c | 15 | ||||
-rw-r--r-- | test/SemaCXX/cxx11-inheriting-ctors.cpp | 28 | ||||
-rw-r--r-- | test/SemaObjCXX/blocks.mm | 16 |
5 files changed, 86 insertions, 1 deletions
diff --git a/test/CodeGen/object-size.c b/test/CodeGen/object-size.c index fe4c1859a272..a824f554b5f4 100644 --- a/test/CodeGen/object-size.c +++ b/test/CodeGen/object-size.c @@ -549,3 +549,22 @@ int incomplete_and_function_types() { // CHECK: store i32 0 gi = __builtin_object_size(incomplete_char_array, 3); } + +// Flips between the pointer and lvalue evaluator a lot. +void deeply_nested() { + struct { + struct { + struct { + struct { + int e[2]; + char f; // Inhibit our writing-off-the-end check + } d[2]; + } c[2]; + } b[2]; + } *a; + + // CHECK: store i32 4 + gi = __builtin_object_size(&a->b[1].c[1].d[1].e[1], 1); + // CHECK: store i32 4 + gi = __builtin_object_size(&a->b[1].c[1].d[1].e[1], 3); +} diff --git a/test/Parser/cxx1z-fold-expressions.cpp b/test/Parser/cxx1z-fold-expressions.cpp index 030638583239..b1f7318e410d 100644 --- a/test/Parser/cxx1z-fold-expressions.cpp +++ b/test/Parser/cxx1z-fold-expressions.cpp @@ -34,3 +34,12 @@ template<int ...N> int bad9() { return (3 + ... * N); } // expected-error {{oper template<int ...N> int bad10() { return (3 ? ... : N); } // expected-error +{{}} expected-note {{to match}} template<int ...N> int bad11() { return (N + ... 0); } // expected-error {{expected a foldable binary operator}} expected-error {{expected expression}} template<int ...N> int bad12() { return (... N); } // expected-error {{expected expression}} + +template<typename ...T> void as_operand_of_cast(int a, T ...t) { + return + (int)(a + ... + undeclared_junk) + // expected-error {{undeclared}} expected-error {{does not contain any unexpanded}} + (int)(t + ... + undeclared_junk) + // expected-error {{undeclared}} + (int)(... + undeclared_junk) + // expected-error {{undeclared}} expected-error {{does not contain any unexpanded}} + (int)(undeclared_junk + ...) + // expected-error {{undeclared}} + (int)(a + ...); // expected-error {{does not contain any unexpanded}} +} diff --git a/test/Sema/builtin-object-size.c b/test/Sema/builtin-object-size.c index 14674c66f3a6..300c739bbd14 100644 --- a/test/Sema/builtin-object-size.c +++ b/test/Sema/builtin-object-size.c @@ -76,3 +76,18 @@ int pr28314(void) { a += __builtin_object_size(p3->b, 0); return a; } + +int pr31843() { + int n = 0; + + struct { int f; } a; + int b; + n += __builtin_object_size(({&(b ? &a : &a)->f; pr31843;}), 0); // expected-warning{{expression result unused}} + + struct statfs { char f_mntonname[1024];}; + struct statfs *outStatFSBuf; + n += __builtin_object_size(outStatFSBuf->f_mntonname ? "" : "", 1); // expected-warning{{address of array}} + n += __builtin_object_size(outStatFSBuf->f_mntonname ?: "", 1); + + return n; +} diff --git a/test/SemaCXX/cxx11-inheriting-ctors.cpp b/test/SemaCXX/cxx11-inheriting-ctors.cpp index c9e01188fd2e..7d6f4f09f09c 100644 --- a/test/SemaCXX/cxx11-inheriting-ctors.cpp +++ b/test/SemaCXX/cxx11-inheriting-ctors.cpp @@ -105,3 +105,31 @@ namespace PR31606 { // Note, we do *not* allow operator=='s argument to use the inherited A::A(Base&&) constructor to construct from B{}. bool b = A{} == B{}; // expected-error {{invalid operands}} } + +namespace implicit_member_srcloc { + template<class T> + struct S3 { + }; + + template<class T> + struct S2 { + S2(S3<T> &&); + }; + + template<class T> + struct S1 : S2<T> { + using S2<T>::S2; + S1(); + }; + + template<class T> + struct S0 { + S0(); + S0(S0&&) = default; + S1<T> m1; + }; + + void foo1() { + S0<int> s0; + } +} diff --git a/test/SemaObjCXX/blocks.mm b/test/SemaObjCXX/blocks.mm index 09d614d37287..3f901cc0a840 100644 --- a/test/SemaObjCXX/blocks.mm +++ b/test/SemaObjCXX/blocks.mm @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify -fblocks -Wno-objc-root-class %s +// RUN: %clang_cc1 -fsyntax-only -verify -fblocks -Wno-objc-root-class -std=c++11 %s @protocol NSObject; void bar(id(^)(void)); @@ -144,3 +144,17 @@ namespace DependentReturn { template void f<X>(X); } + +namespace MoveBlockVariable { +struct B0 { +}; + +struct B1 { // expected-note 2 {{candidate constructor (the implicit}} + B1(B0&&); // expected-note {{candidate constructor not viable}} +}; + +B1 test_move() { + __block B0 b; + return b; // expected-error {{no viable conversion from returned value of type 'MoveBlockVariable::B0' to function return type 'MoveBlockVariable::B1'}} +} +} |