diff options
author | NAKAMURA Takumi <geek4civic@gmail.com> | 2025-01-09 18:43:11 +0900 |
---|---|---|
committer | NAKAMURA Takumi <geek4civic@gmail.com> | 2025-01-09 18:43:11 +0900 |
commit | 0e1a753549b29ff1f5a190aca83b803a33b51628 (patch) | |
tree | e5578f8810c65711304128d0c8add7fa1f77b9d8 /clang/test/SemaOpenACC/set-construct.cpp | |
parent | 3c6252260ee11e3a453076b4d96ffffe20d49998 (diff) | |
parent | bdcf47e4bcb92889665825654bb80a8bbe30379e (diff) | |
download | llvm-users/chapuni/cov/single/if.zip llvm-users/chapuni/cov/single/if.tar.gz llvm-users/chapuni/cov/single/if.tar.bz2 |
Merge branch 'users/chapuni/cov/single/base' into users/chapuni/cov/single/ifusers/chapuni/cov/single/if
Conflicts:
clang/lib/CodeGen/CoverageMappingGen.cpp
Diffstat (limited to 'clang/test/SemaOpenACC/set-construct.cpp')
-rw-r--r-- | clang/test/SemaOpenACC/set-construct.cpp | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/clang/test/SemaOpenACC/set-construct.cpp b/clang/test/SemaOpenACC/set-construct.cpp new file mode 100644 index 0000000..23816db --- /dev/null +++ b/clang/test/SemaOpenACC/set-construct.cpp @@ -0,0 +1,69 @@ +// RUN: %clang_cc1 %s -fopenacc -verify + +struct NotConvertible{} NC; +short getS(); +int getI(); + +struct AmbiguousConvert{ + operator int(); // #AMBIG_INT + operator short(); // #AMBIG_SHORT + operator float(); +} Ambiguous; + +struct ExplicitConvertOnly { + explicit operator int() const; // #EXPL_CONV +} Explicit; + +void uses() { +#pragma acc set default_async(getI()) +#pragma acc set device_num(getI()) +#pragma acc set device_type(getI) +#pragma acc set device_type(getI) if (getI() < getS()) + + // expected-error@+1{{value of type 'struct NotConvertible' is not contextually convertible to 'bool'}} +#pragma acc set if (NC) device_type(I) + + // expected-error@+2{{OpenACC 'set' construct must have at least one 'default_async', 'device_num', 'device_type' or 'if' clause}} + // expected-error@+1{{OpenACC clause 'device_num' requires expression of integer type ('struct NotConvertible' invalid)}} +#pragma acc set device_num(NC) + // expected-error@+4{{OpenACC 'set' construct must have at least one 'default_async', 'device_num', 'device_type' or 'if' clause}} + // expected-error@+3{{multiple conversions from expression type 'struct AmbiguousConvert' to an integral type}} + // expected-note@#AMBIG_INT{{conversion to integral type 'int'}} + // expected-note@#AMBIG_SHORT{{conversion to integral type 'short'}} +#pragma acc set device_num(Ambiguous) + // expected-error@+2{{OpenACC integer expression requires explicit conversion from 'struct ExplicitConvertOnly' to 'int'}} + // expected-note@#EXPL_CONV{{conversion to integral type 'int'}} +#pragma acc set device_num(Explicit) + + // expected-error@+2{{OpenACC clause 'default_async' requires expression of integer type ('struct NotConvertible' invalid)}} + // expected-error@+1{{OpenACC 'set' construct must have at least one 'default_async', 'device_num', 'device_type' or 'if' clause}} +#pragma acc set default_async(NC) + // expected-error@+4{{multiple conversions from expression type 'struct AmbiguousConvert' to an integral type}} + // expected-note@#AMBIG_INT{{conversion to integral type 'int'}} + // expected-note@#AMBIG_SHORT{{conversion to integral type 'short'}} + // expected-error@+1{{OpenACC 'set' construct must have at least one 'default_async', 'device_num', 'device_type' or 'if' clause}} +#pragma acc set default_async(Ambiguous) + // expected-error@+2{{OpenACC integer expression requires explicit conversion from 'struct ExplicitConvertOnly' to 'int'}} + // expected-note@#EXPL_CONV{{conversion to integral type 'int'}} +#pragma acc set default_async(Explicit) + + // expected-error@+1{{OpenACC 'set' construct must have at least one 'default_async', 'device_num', 'device_type' or 'if' clause}} +#pragma acc set + +#pragma acc set if (true) + + // expected-error@+2{{'default_async' clause cannot appear more than once on a 'set' directive}} + // expected-note@+1{{previous clause is here}} +#pragma acc set default_async(getI()) default_async(getI()) + + // expected-error@+2{{'device_num' clause cannot appear more than once on a 'set' directive}} + // expected-note@+1{{previous clause is here}} +#pragma acc set device_num(getI()) device_num(getI()) + + // expected-error@+2{{'device_type' clause cannot appear more than once on a 'set' directive}} + // expected-note@+1{{previous clause is here}} +#pragma acc set device_type(I) device_type(I) + // expected-error@+2{{'if' clause cannot appear more than once on a 'set' directive}} + // expected-note@+1{{previous clause is here}} +#pragma acc set device_type(I) if(true) if (true) +} |