Skip to content

Commit 8fb440a

Browse files
committed
Update 'init' and 'shutdown' tests to accept that multiples of 'if' are ill-formed
1 parent 5b50f08 commit 8fb440a

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

clang/test/SemaOpenACC/init-construct.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,11 @@ void TestInst() {
4242
#pragma acc init
4343
#pragma acc init if (T::value < T{})
4444
#pragma acc init device_type(radeon) device_num(getI()) if (getI() < getS())
45-
#pragma acc init device_type(multicore) device_type(host) device_num(t) if (t < T::value) device_num(getI()) if (getI() < getS())
45+
#pragma acc init device_type(multicore) device_type(host) device_num(t) if (t < T::value) device_num(getI())
46+
47+
// expected-error@+2{{OpenACC 'if' clause cannot appear more than once on a 'init' directive}}
48+
// expected-note@+1{{previous clause is here}}
49+
#pragma acc init if(t < T::value) if (getI() < getS())
4650

4751
// expected-error@+1{{value of type 'const NotConvertible' is not contextually convertible to 'bool'}}
4852
#pragma acc init if (T::NCValue)

clang/test/SemaOpenACC/shutdown-construct.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,15 @@ void TestInst() {
4242
#pragma acc shutdown
4343
#pragma acc shutdown if (T::value < T{})
4444
#pragma acc shutdown device_type(multicore) device_num(getI()) if (getI() < getS())
45-
#pragma acc shutdown device_type(default) device_type(radeon) device_num(t) if (t < T::value) device_num(getI()) if (getI() < getS())
45+
#pragma acc shutdown device_type(default) device_type(radeon) device_num(t) if (t < T::value) device_num(getI())
4646

4747
// expected-error@+1{{value of type 'const NotConvertible' is not contextually convertible to 'bool'}}
4848
#pragma acc shutdown if (T::NCValue)
4949

50+
// expected-error@+2{{OpenACC 'if' clause cannot appear more than once on a 'shutdown' directive}}
51+
// expected-note@+1{{previous clause is here}}
52+
#pragma acc shutdown if(t < T::value) if (getI() < getS())
53+
5054
// expected-error@+1{{OpenACC clause 'device_num' requires expression of integer type ('const NotConvertible' invalid)}}
5155
#pragma acc shutdown device_num(T::NCValue)
5256
// expected-error@+3{{multiple conversions from expression type 'const AmbiguousConvert' to an integral type}}

0 commit comments

Comments
 (0)