1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
|
// { dg-do compile }
// { dg-options "-fopenmp" }
namespace N1
{
#pragma omp declare reduction (| : long int : omp_out |= omp_in) // { dg-error "predeclared arithmetic type" }
#pragma omp declare reduction (+ : char : omp_out += omp_in) // { dg-error "predeclared arithmetic type" }
typedef short T;
#pragma omp declare reduction (min : T : omp_out += omp_in) // { dg-error "predeclared arithmetic type" }
#pragma omp declare reduction (* : _Complex double : omp_out *= omp_in)// { dg-error "predeclared arithmetic type" }
}
namespace N2
{
template <typename T1, typename T2, typename T3, typename T4>
struct S
{
#pragma omp declare reduction (| : T1 : omp_out |= omp_in) // { dg-error "predeclared arithmetic type" }
#pragma omp declare reduction (+ : T2 : omp_out += omp_in) // { dg-error "predeclared arithmetic type" }
typedef T3 T;
#pragma omp declare reduction (min : T : omp_out += omp_in) // { dg-error "predeclared arithmetic type" }
#pragma omp declare reduction (* : T4 : omp_out *= omp_in) // { dg-error "predeclared arithmetic type" }
};
S<long int, char, short, _Complex double> s;
template <typename T1, typename T2, typename T3, typename T4>
int foo ()
{
#pragma omp declare reduction (| : T1 : omp_out |= omp_in) // { dg-error "predeclared arithmetic type" }
#pragma omp declare reduction (+ : T2 : omp_out += omp_in) // { dg-error "predeclared arithmetic type" }
typedef T3 T;
#pragma omp declare reduction (min : T : omp_out += omp_in) // { dg-error "predeclared arithmetic type" }
#pragma omp declare reduction (* : T4 : omp_out *= omp_in) // { dg-error "predeclared arithmetic type" }
return 0;
}
int x = foo <long int, char, short, _Complex double> ();
}
namespace N3
{
void bar ();
#pragma omp declare reduction (| : __typeof (bar) : omp_out |= omp_in)// { dg-error "function or array type" }
#pragma omp declare reduction (+ : char () : omp_out += omp_in) // { dg-error "function or array type" }
typedef short T;
#pragma omp declare reduction (min : T[2] : omp_out += omp_in) // { dg-error "function or array type" }
#pragma omp declare reduction (baz : char & : omp_out *= omp_in) // { dg-error "reference type" }
}
namespace N4
{
void bar ();
template <typename T1, typename T2, typename T3, typename T4>
struct S
{
#pragma omp declare reduction (| : T1 : omp_out |= omp_in) // { dg-error "function or array type" }
#pragma omp declare reduction (+ : T2 : omp_out += omp_in) // { dg-error "function or array type" }
typedef T3 T;
#pragma omp declare reduction (min : T : omp_out += omp_in) // { dg-error "function or array type" }
#pragma omp declare reduction (baz : T4 : omp_out *= omp_in) // { dg-error "function or array type" }
};
S<__typeof (bar), char (), short [3], char []> s;
template <typename T1, typename T2, typename T3, typename T4>
int foo ()
{
#pragma omp declare reduction (| : T1 : omp_out |= omp_in) // { dg-error "function or array type" }
#pragma omp declare reduction (+ : T2 : omp_out += omp_in) // { dg-error "function or array type" }
typedef T3 T;
#pragma omp declare reduction (min : T : omp_out += omp_in) // { dg-error "function or array type" }
#pragma omp declare reduction (baz : T4 : omp_out *= omp_in) // { dg-error "function or array type" }
return 0;
}
int x = foo <__typeof (bar), char (), short[], char [2]> ();
}
namespace N5
{
template <typename T>
struct S
{
#pragma omp declare reduction (baz : T : omp_out *= omp_in) // { dg-error "reference type" }
};
S<char &> s;
template <typename T>
int foo ()
{
#pragma omp declare reduction (baz : T : omp_out *= omp_in) // { dg-error "reference type" }
return 0;
}
int x = foo <char &> ();
}
namespace N6
{
struct A { int a; A () : a (0) {} };
#pragma omp declare reduction (| : const A : omp_out.a |= omp_in.a) // { dg-error "const, volatile or __restrict" }
#pragma omp declare reduction (+ : __const A : omp_out.a += omp_in.a) // { dg-error "const, volatile or __restrict" }
typedef volatile A T;
#pragma omp declare reduction (min : T : omp_out.a += omp_in.a) // { dg-error "const, volatile or __restrict" }
#pragma omp declare reduction (* : A *__restrict : omp_out->a *= omp_in->a)// { dg-error "const, volatile or __restrict" }
}
namespace N7
{
struct A { int a; A () : a (0) {} };
template <typename T1, typename T2, typename T3, typename T4>
struct S
{
#pragma omp declare reduction (| : T1 : omp_out |= omp_in) // { dg-error "const, volatile or __restrict" }
#pragma omp declare reduction (+ : T2 : omp_out += omp_in) // { dg-error "const, volatile or __restrict" }
typedef T3 T;
#pragma omp declare reduction (min : T : omp_out += omp_in) // { dg-error "const, volatile or __restrict" }
#pragma omp declare reduction (* : T4 : omp_out *= omp_in) // { dg-error "const, volatile or __restrict" }
};
S<const A, __const A, volatile A, A *__restrict> s;
template <typename T1, typename T2, typename T3, typename T4>
int foo ()
{
#pragma omp declare reduction (| : T1 : omp_out |= omp_in) // { dg-error "const, volatile or __restrict" }
#pragma omp declare reduction (+ : T2 : omp_out += omp_in) // { dg-error "const, volatile or __restrict" }
typedef T3 T;
#pragma omp declare reduction (min : T : omp_out += omp_in) // { dg-error "const, volatile or __restrict" }
#pragma omp declare reduction (* : T4 : omp_out *= omp_in) // { dg-error "const, volatile or __restrict" }
return 0;
}
int x = foo <const A, __const A, volatile A, A *__restrict> ();
}
|