88 lines · cpp
1// RUN: %clang_cc1 %s -verify -fopenacc2 3template<unsigned I, typename T>4void templ() {5#pragma acc loop collapse(I)6 for(int i = 0; i < 5;++i)7 for(int j = 0; j < 5; ++j)8 for(int k = 0; k < 5; ++k)9 for(int l = 0; l < 5; ++l)10 for(int m = 0; m < 5; ++m)11 for(int n = 0; n < 5; ++n)12 for(int o = 0; o < 5; ++o);13 14#pragma acc loop collapse(T::value)15 for(int i = 0;i < 5;++i)16 for(int j = 0; j < 5; ++j)17 for(int k = 0; k < 5; ++k)18 for(int l = 0; l < 5; ++l)19 for(int m = 0; m < 5;++m)20 for(;;)21 for(;;);22 23#pragma acc parallel vector_length(T::value)24 for(;;){}25 26#pragma acc parallel vector_length(I)27 for(;;){}28 29#pragma acc parallel async(T::value)30 for(;;){}31 32#pragma acc parallel async(I)33 for(;;){}34 35#pragma acc parallel async36 for(;;){}37 38 39 T t;40#pragma acc exit data delete(t)41 ;42}43 44struct S {45 static constexpr unsigned value = 5;46};47 48void use() {49 templ<7, S>();50}51 52// expected-error@+2{{expected ')'}}53// expected-note@+1{{to match this '('}}54#pragma acc routine(use) seq bind(NS::NSFunc)55 56 // expected-error@+1{{string literal with user-defined suffix cannot be used here}}57#pragma acc routine(use) seq bind("unknown udl"_UDL)58 59 // expected-warning@+1{{encoding prefix 'u' on an unevaluated string literal has no effect}}60#pragma acc routine(use) seq bind(u"16 bits")61void another_func();62 // expected-warning@+1{{encoding prefix 'U' on an unevaluated string literal has no effect}}63#pragma acc routine(another_func) seq bind(U"32 bits")64 65void AtomicIf() {66 int i, j;67 // expected-error@+1{{expected '('}}68#pragma acc atomic read if69 i = j;70#pragma acc atomic read if (true)71 i = j;72#pragma acc atomic write if (false)73 i = j + 1;74 75#pragma acc atomic update if (i)76 ++i;77#pragma acc atomic if (j)78 ++i;79 80#pragma acc atomic capture if (true)81 i = j++;82#pragma acc atomic capture if (i)83 {84 ++j;85 i = j;86 }87}88