blob: 3d8ea89ceb43a5100c33137f9974774764346646 (
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
42
43
44
45
46
47
|
// PR c++/58706
// { dg-do run }
// { dg-options "-std=c++11" }
template <typename T>
T
foo ()
{
T n = T ();
#pragma omp parallel for reduction (+: n)
for (T i = [](){ return 3; }(); i < 10; ++i)
n++;
return n;
}
template <typename T>
T
bar ()
{
T n = T ();
#pragma omp parallel for reduction (+: n)
for (T i = [](){ return 1; }() + [](){ return 4; }(); i < 10; ++i)
n++;
return n;
}
template <typename T>
T
baz ()
{
T n = T ();
#pragma omp parallel for reduction (+: n)
for (T i = T (); i < [](){ return 7; }() + [](){ return 11; }(); i += [](){ return 3; }() - [](){ return 1; }())
n++;
return n;
}
int
main ()
{
if (foo <int> () != 7 || foo <long long> () != 7)
__builtin_abort ();
if (bar <int> () != 5 || bar <char> () != 5)
__builtin_abort ();
if (baz <int> () != 9 || baz <long long> () != 9)
__builtin_abort ();
}
|