summaryrefslogtreecommitdiffstats
path: root/clang/test/OpenMP/declare_reduction_messages.cpp
diff options
context:
space:
mode:
authorAlexey Bataev <a.bataev@hotmail.com>2018-09-13 16:54:05 +0000
committerAlexey Bataev <a.bataev@hotmail.com>2018-09-13 16:54:05 +0000
commite6aa4694de2d11fdc3e352a29b1491740bfcb5e5 (patch)
tree544278f19137d1f2e4d9ceb4011e0b2ea9093fc8 /clang/test/OpenMP/declare_reduction_messages.cpp
parent939468d4b278a2432df1ed962fe3ba447b3adafe (diff)
downloadbcm5719-llvm-e6aa4694de2d11fdc3e352a29b1491740bfcb5e5.tar.gz
bcm5719-llvm-e6aa4694de2d11fdc3e352a29b1491740bfcb5e5.zip
[OPENMP] Fix PR38903: Crash on instantiation of the non-dependent
declare reduction. If the declare reduction construct with the non-dependent type is defined in the template construct, the compiler might crash on the template instantition. Reworked the whole instantiation scheme for the declare reduction constructs to fix this problem correctly. llvm-svn: 342151
Diffstat (limited to 'clang/test/OpenMP/declare_reduction_messages.cpp')
-rw-r--r--clang/test/OpenMP/declare_reduction_messages.cpp22
1 files changed, 19 insertions, 3 deletions
diff --git a/clang/test/OpenMP/declare_reduction_messages.cpp b/clang/test/OpenMP/declare_reduction_messages.cpp
index f22f92485a5..21c03fac228 100644
--- a/clang/test/OpenMP/declare_reduction_messages.cpp
+++ b/clang/test/OpenMP/declare_reduction_messages.cpp
@@ -142,17 +142,33 @@ int main() {
#if __cplusplus == 201103L
struct A {
A() {}
- // expected-note@+1 {{copy constructor is implicitly deleted because 'A' has a user-declared move assignment operator}}
A& operator=(A&&) = default;
};
int A_TEST() {
A test;
-// expected-error@+1 {{call to implicitly-deleted copy constructor of 'A'}}
#pragma omp declare reduction(+ : A : omp_out) initializer(omp_priv = A())
-// expected-error@+1 {{invalid operands to binary expression ('A' and 'A')}}
#pragma omp parallel reduction(+ : test)
{}
return 0;
}
+
+struct U
+{
+ void foo(U&, bool);
+ U();
+};
+template <int N>
+struct S
+{
+ int s;
+ // expected-note@+1 {{'foo' declared here}}
+ void foo(S &x) {};
+ // expected-error@+1 {{too many arguments to function call, expected single argument 'x', have 2 arguments}}
+ #pragma omp declare reduction (foo : U, S : omp_out.foo(omp_in, false))
+};
+// expected-warning@+2 {{extra tokens at the end of '#pragma omp declare reduction' are ignored}}
+// expected-note@+1 {{in instantiation of template class 'S<1>' requested here}}
+#pragma omp declare reduction (bar : S<1> : omp_out.foo(omp_in))
+
#endif
OpenPOWER on IntegriCloud