blob: 1929e45f884808a8a2565c67a685404eaa2b2e12 (
plain)
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
|
// PR c++/38348
// { dg-do compile }
// { dg-options "-fopenmp" }
const char *p = "abcde";
template <typename T>
void
f1 (void)
{
#pragma omp for // { dg-error "forbids incrementing a pointer of type" }
for (void *q = (void *)p; q < (void *) (p + 4); q++) // { dg-error "forbids incrementing a pointer of type" }
;
}
template <typename T>
void
f2 (void)
{
#pragma omp for
for (const char *q = p; q < p + 4; q++)
;
}
template <typename T>
void
f3 (void)
{
#pragma omp for // { dg-error "forbids incrementing a pointer of type" }
for (T q = T (p); q < T (p + 4); q++)
;
}
int
main (void)
{
f1 <int> (); // { dg-message "instantiated from here" }
f2 <int> ();
f3 <const char *> ();
f3 <void *> (); // { dg-message "instantiated from here" }
}
|