summaryrefslogtreecommitdiffstats
path: root/test/OpenMP/atomic_messages.cpp
diff options
context:
space:
mode:
authorAlexey Bataev <a.bataev@hotmail.com>2014-07-23 02:27:21 +0000
committerAlexey Bataev <a.bataev@hotmail.com>2014-07-23 02:27:21 +0000
commit73ef460bebcb8e7e7620f4337a3e47c879af8f9d (patch)
treec074f13217f41b977eec792a780eb2870906eedc /test/OpenMP/atomic_messages.cpp
parent93766313da42cbc2eed7b28d284a5735c72391f4 (diff)
[OPENMP] Initial parsing and sema analysis for 'read' clause in 'atomic' directive.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@213717 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/OpenMP/atomic_messages.cpp')
-rw-r--r--test/OpenMP/atomic_messages.cpp37
1 files changed, 32 insertions, 5 deletions
diff --git a/test/OpenMP/atomic_messages.cpp b/test/OpenMP/atomic_messages.cpp
index 6eef8f227d..7b35e42dc7 100644
--- a/test/OpenMP/atomic_messages.cpp
+++ b/test/OpenMP/atomic_messages.cpp
@@ -1,20 +1,47 @@
// RUN: %clang_cc1 -verify -fopenmp=libiomp5 -ferror-limit 100 %s
int foo() {
- L1:
- foo();
- #pragma omp atomic
+L1:
+ foo();
+#pragma omp atomic
{
foo();
goto L1; // expected-error {{use of undeclared label 'L1'}}
}
goto L2; // expected-error {{use of undeclared label 'L2'}}
- #pragma omp atomic
+#pragma omp atomic
{
foo();
- L2:
+ L2:
foo();
}
return 0;
}
+
+template <class T>
+T read() {
+ T a, b = 0;
+// Test for atomic read
+#pragma omp atomic read
+// expected-error@+1 {{the statement for 'atomic read' must be an expression statement of form 'v = x;', where v and x are both l-value expressions with scalar type}}
+ ;
+// expected-error@+1 {{directive '#pragma omp atomic' cannot contain more than one 'read' clause}}
+#pragma omp atomic read read
+ a = b;
+
+ return T();
+}
+
+int read() {
+ int a, b = 0;
+// Test for atomic read
+#pragma omp atomic read
+// expected-error@+1 {{the statement for 'atomic read' must be an expression statement of form 'v = x;', where v and x are both l-value expressions with scalar type}}
+ ;
+// expected-error@+1 {{directive '#pragma omp atomic' cannot contain more than one 'read' clause}}
+#pragma omp atomic read read
+ a = b;
+
+ return read<int>();
+}