1 // PR c++/79664 2 // { dg-do compile } 3 // { dg-options "-std=c++14 -fopenmp" } 4 5 constexpr int f1()6f1 () 7 { 8 int i = 0; 9 #pragma omp parallel for // { dg-error "is not a constant-expression" } 10 for (i = 0; i < 10; ++i) 11 ; 12 return 0; 13 } 14 15 constexpr int f2()16f2 () 17 { 18 int i = 0; 19 #pragma omp parallel // { dg-error "is not a constant-expression" } 20 i = 5; 21 return 0; 22 } 23 24 constexpr int f3()25f3 () 26 { 27 int i = 0; 28 #pragma omp task // { dg-error "is not a constant-expression" } 29 i = 5; 30 return 0; 31 } 32 33 constexpr int f4()34f4 () 35 { 36 int i = 0; 37 #pragma omp for // { dg-error "is not a constant-expression" } 38 for (i = 0; i < 10; ++i) 39 ; 40 return 0; 41 } 42 43 constexpr int f5()44f5 () 45 { 46 int i = 0; 47 #pragma omp taskloop // { dg-error "is not a constant-expression" } 48 for (i = 0; i < 10; ++i) 49 ; 50 return 0; 51 } 52 53 constexpr int f6()54f6 () 55 { 56 int i = 0; 57 #pragma omp target teams // { dg-error "is not a constant-expression" } 58 i = 5; 59 return 0; 60 } 61 62 constexpr int f7()63f7 () 64 { 65 int i = 0; 66 #pragma omp target data map(tofrom:i) // { dg-error "is not a constant-expression" } 67 i = 5; 68 return 0; 69 } 70 71 constexpr int f8()72f8 () 73 { 74 int i = 0; 75 #pragma omp target // { dg-error "is not a constant-expression" } 76 i = 5; 77 return 0; 78 } 79 80 constexpr int f9()81f9 () 82 { 83 int i = 0; 84 #pragma omp sections // { dg-error "is not a constant-expression" } 85 { 86 #pragma omp section 87 i = 5; 88 } 89 return 0; 90 } 91 92 constexpr int f10()93f10 () 94 { 95 int i = 0; 96 #pragma omp ordered // { dg-error "is not a constant-expression" } 97 i = 1; 98 return 0; 99 } 100 101 constexpr int f11()102f11 () 103 { 104 int i = 0; 105 #pragma omp critical // { dg-error "is not a constant-expression" } 106 i = 1; 107 return 0; 108 } 109 110 constexpr int f12()111f12 () 112 { 113 int i = 0; 114 #pragma omp single // { dg-error "is not a constant-expression" } 115 i = 1; 116 return 0; 117 } 118 119 constexpr int f13()120f13 () 121 { 122 int i = 0; 123 #pragma omp master // { dg-error "is not a constant-expression" } 124 i = 1; 125 return 0; 126 } 127 128 constexpr int f14()129f14 () 130 { 131 int i = 0; 132 #pragma omp taskgroup // { dg-error "is not a constant-expression" } 133 i = 1; 134 return 0; 135 } 136 137 constexpr int f15()138f15 () 139 { 140 int i = 0; 141 #pragma omp target update to(i) // { dg-error "is not a constant-expression" } 142 i = 1; 143 return 0; 144 } 145 146 constexpr int f16()147f16 () 148 { 149 int i = 0; 150 #pragma omp target update to(i) // { dg-error "is not a constant-expression" } 151 return 0; 152 } 153 154 constexpr int f17()155f17 () 156 { 157 int i = 0; 158 #pragma omp target enter data map(to:i) // { dg-error "is not a constant-expression" } 159 return 0; 160 } 161 162 constexpr int f18()163f18 () 164 { 165 int i = 0; 166 #pragma omp target exit data map(from:i) // { dg-error "is not a constant-expression" } 167 return 0; 168 } 169