aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/CodeGen/builtins-x86.c5
-rw-r--r--test/Sema/block-args.c2
-rw-r--r--test/Sema/block-call.c4
-rw-r--r--test/Sema/block-misc.c6
-rw-r--r--test/SemaObjC/blocks.m2
-rw-r--r--test/SemaTemplate/instantiate-objc-1.mm47
-rw-r--r--test/SemaTemplate/temp_class_spec.cpp32
7 files changed, 86 insertions, 12 deletions
diff --git a/test/CodeGen/builtins-x86.c b/test/CodeGen/builtins-x86.c
index 8d4bcbfab17b..f49e7b670dec 100644
--- a/test/CodeGen/builtins-x86.c
+++ b/test/CodeGen/builtins-x86.c
@@ -325,14 +325,9 @@ void f0() {
tmp_V8s = __builtin_ia32_pmaddwd128(tmp_V8s, tmp_V8s);
(void) __builtin_ia32_monitor(tmp_vp, tmp_Ui, tmp_Ui);
(void) __builtin_ia32_mwait(tmp_Ui, tmp_Ui);
-#ifdef USE_ALL
- tmp_V4f = __builtin_ia32_movshdup(tmp_V4f);
- tmp_V4f = __builtin_ia32_movsldup(tmp_V4f);
-#endif
tmp_V16c = __builtin_ia32_lddqu(tmp_cCp);
tmp_V2LLi = __builtin_ia32_palignr128(tmp_V2LLi, tmp_V2LLi, imm_i);
tmp_V1LLi = __builtin_ia32_palignr(tmp_V1LLi, tmp_V1LLi, imm_i);
- tmp_V4i = __builtin_ia32_loadlv4si(tmp_V2ip);
(void) __builtin_ia32_storelv4si(tmp_V2ip, tmp_V2LLi);
#ifdef USE_SSE4
tmp_V16c = __builtin_ia32_pblendvb128(tmp_V16c, tmp_V16c, tmp_V16c);
diff --git a/test/Sema/block-args.c b/test/Sema/block-args.c
index a2d8e5a86731..27bee77da6c6 100644
--- a/test/Sema/block-args.c
+++ b/test/Sema/block-args.c
@@ -18,7 +18,7 @@ void test() {
^{return 1;}();
^{return 2;}(arg); // expected-error {{too many arguments to block call}}
^(void){return 3;}(1); // expected-error {{too many arguments to block call}}
- ^(){return 4;}(arg); // C style (...), ok.
+ ^(){return 4;}(arg); // expected-error {{too many arguments to block call}}
^(int x, ...){return 5;}(arg, arg); // Explicit varargs, ok.
}
diff --git a/test/Sema/block-call.c b/test/Sema/block-call.c
index 9d3ff71e2195..c42b642337ca 100644
--- a/test/Sema/block-call.c
+++ b/test/Sema/block-call.c
@@ -7,10 +7,10 @@ int main() {
int (*FPL) (int) = FP; // C doesn't consider this an error.
// For Blocks, the ASTContext::typesAreBlockCompatible() makes sure this is an error.
- int (^PFR) (int) = IFP; // expected-error {{incompatible block pointer types initializing 'int (^)()', expected 'int (^)(int)'}}
+ int (^PFR) (int) = IFP; // OK
PFR = II; // OK
- int (^IFP) () = PFR;
+ int (^IFP) () = PFR; // OK
const int (^CIC) () = IFP; // expected-error {{incompatible block pointer types initializing 'int (^)()', expected 'int const (^)()'}}
diff --git a/test/Sema/block-misc.c b/test/Sema/block-misc.c
index 93ca3c49d425..294c295c5f8c 100644
--- a/test/Sema/block-misc.c
+++ b/test/Sema/block-misc.c
@@ -10,7 +10,7 @@ int test1() {
if (PFR == II) // OK
donotwarn();
- if (PFR == IFP) // expected-error {{comparison of distinct block types}}
+ if (PFR == IFP) // OK
donotwarn();
if (PFR == (int (^) (int))IFP) // OK
@@ -25,7 +25,7 @@ int test1() {
if (!PFR) // OK
donotwarn();
- return PFR != IFP; // expected-error {{comparison of distinct block types}}
+ return PFR != IFP; // OK
}
int test2(double (^S)()) {
@@ -165,7 +165,7 @@ void test17() {
f(1 ? bp : vp);
f(1 ? vp : bp);
- f(1 ? bp : bp1); // expected-error {{incompatible operand types ('void (^)(int)' and 'void (^)()')}}
+ f(1 ? bp : bp1);
(void)(bp > rp); // expected-error {{invalid operands}}
(void)(bp > 0); // expected-error {{invalid operands}}
(void)(bp > bp); // expected-error {{invalid operands}}
diff --git a/test/SemaObjC/blocks.m b/test/SemaObjC/blocks.m
index baadbde3e040..6dab289ae9f2 100644
--- a/test/SemaObjC/blocks.m
+++ b/test/SemaObjC/blocks.m
@@ -28,7 +28,7 @@ void foo5(id (^objectCreationBlock)(int)) {
void bar6(id(^)(int));
void foo6(id (^objectCreationBlock)()) {
- return bar6(objectCreationBlock); // expected-error {{incompatible block pointer types passing 'id (^)()', expected 'id (^)(int)'}}
+ return bar6(objectCreationBlock);
}
void foo7(id (^x)(int)) {
diff --git a/test/SemaTemplate/instantiate-objc-1.mm b/test/SemaTemplate/instantiate-objc-1.mm
new file mode 100644
index 000000000000..829acb2e199b
--- /dev/null
+++ b/test/SemaTemplate/instantiate-objc-1.mm
@@ -0,0 +1,47 @@
+// RUN: clang-cc -fsyntax-only -verify %s
+
+// Obj-C string literal expressions
+template <typename T> struct StringTest {
+ void f() {
+ (void)@"Hello";
+ }
+};
+
+template struct StringTest<int>;
+template struct StringTest<double>;
+
+// @selector expressions
+template <typename T> struct SelectorTest {
+ SEL f() {
+ return @selector(multiple:arguments:);
+ }
+ SEL f2() {
+ return @selector(multiple:arguments:);
+ }
+};
+
+template struct SelectorTest<int>;
+template struct SelectorTest<double>;
+
+// @protocol expressions
+@protocol P
+@end
+
+template <typename T> struct ProtocolTest {
+ void f() {
+ (void)@protocol(P);
+ }
+};
+
+template struct ProtocolTest<int>;
+template struct ProtocolTest<double>;
+
+// @encode expressions
+template <typename T> struct EncodeTest {
+ static const char *encode(T t) {
+ return @encode(T);
+ }
+};
+
+template struct EncodeTest<int>;
+template struct EncodeTest<double>;
diff --git a/test/SemaTemplate/temp_class_spec.cpp b/test/SemaTemplate/temp_class_spec.cpp
index 8cb46cf98f84..4e4f5560aef3 100644
--- a/test/SemaTemplate/temp_class_spec.cpp
+++ b/test/SemaTemplate/temp_class_spec.cpp
@@ -102,3 +102,35 @@ struct get_array_size<T[N]> {
};
int array_size0[get_array_size<int[12]>::value == 12? 1 : -1];
+
+template<typename T>
+struct is_unary_function {
+ static const bool value = false;
+};
+
+template<typename T, typename U>
+struct is_unary_function<T (*)(U)> {
+ static const bool value = true;
+};
+
+int is_unary_function0[is_unary_function<int>::value ? -1 : 1];
+int is_unary_function1[is_unary_function<int (*)()>::value ? -1 : 1];
+int is_unary_function2[is_unary_function<int (*)(int, bool)>::value ? -1 : 1];
+int is_unary_function3[is_unary_function<int (*)(bool)>::value ? 1 : -1];
+int is_unary_function4[is_unary_function<int (*)(int)>::value ? 1 : -1];
+
+template<typename T>
+struct is_unary_function_with_same_return_type_as_argument_type {
+ static const bool value = false;
+};
+
+template<typename T>
+struct is_unary_function_with_same_return_type_as_argument_type<T (*)(T)> {
+ static const bool value = true;
+};
+
+int is_unary_function5[is_unary_function_with_same_return_type_as_argument_type<int>::value ? -1 : 1];
+int is_unary_function6[is_unary_function_with_same_return_type_as_argument_type<int (*)()>::value ? -1 : 1];
+int is_unary_function7[is_unary_function_with_same_return_type_as_argument_type<int (*)(int, bool)>::value ? -1 : 1];
+int is_unary_function8[is_unary_function_with_same_return_type_as_argument_type<int (*)(bool)>::value ? -1 : 1];
+int is_unary_function9[is_unary_function_with_same_return_type_as_argument_type<int (*)(int)>::value ? 1 : -1];