aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/SemaOpenCL/half.cl28
1 files changed, 13 insertions, 15 deletions
diff --git a/test/SemaOpenCL/half.cl b/test/SemaOpenCL/half.cl
index 830d178d7c..0e6acb78c4 100644
--- a/test/SemaOpenCL/half.cl
+++ b/test/SemaOpenCL/half.cl
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only
+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -Wno-unused-value
#pragma OPENCL EXTENSION cl_khr_fp16 : disable
@@ -7,16 +7,15 @@ half half_disabled(half *p, // expected-error{{declaring function return value o
{
half a[2]; // expected-error{{declaring variable of type 'half [2]' is not allowed}}
half b; // expected-error{{declaring variable of type 'half' is not allowed}}
-
- b = *p; // expected-error{{dereferencing pointer of type 'half *' is not allowed}}
- *p = b; // expected-error{{dereferencing pointer of type 'half *' is not allowed}}
-
- b = p[1]; // expected-error {{subscript to array of type 'half' is not allowed}}
- p[1] = b; // expected-error {{subscript to array of type 'half' is not allowed}}
+ *p; // expected-error{{loading directly from pointer to type 'half' is not allowed}}
+ p[1]; // expected-error{{loading directly from pointer to type 'half' is not allowed}}
float c = 1.0f;
b = (half) c; // expected-error{{casting to type 'half' is not allowed}}
- c = (float) h; // expected-error{{casting from type 'half' is not allowed}}
+
+ half *allowed = &p[1];
+ half *allowed2 = &*p;
+ half *allowed3 = p + 1;
return h;
}
@@ -27,16 +26,15 @@ half half_enabled(half *p, half h)
{
half a[2];
half b;
-
- b = *p;
- *p = b;
-
- b = p[1];
- p[1] = b;
+ *p;
+ p[1];
float c = 1.0f;
b = (half) c;
- c = (float) h;
+
+ half *allowed = &p[1];
+ half *allowed2 = &*p;
+ half *allowed3 = p + 1;
return h;
}