Skip to content

Commit 03420e3

Browse files
author
urvi-rav
committed
allocators without traits
1 parent 1efc6c0 commit 03420e3

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

clang/lib/Sema/SemaOpenMP.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24083,11 +24083,13 @@ OMPClause *SemaOpenMP::ActOnOpenMPUsesAllocatorClause(
2408324083
// OpenMP [2.12.5, target Construct]
2408424084
// Non-predefined allocators appearing in a uses_allocators clause must
2408524085
// have traits specified.
24086+
if (getLangOpts().OpenMP < 52) {
2408624087
if (!IsPredefinedAllocator && !D.AllocatorTraits) {
2408724088
Diag(D.Allocator->getExprLoc(),
2408824089
diag::err_omp_nonpredefined_allocator_without_traits);
2408924090
continue;
2409024091
}
24092+
}
2409124093
// No allocator traits - just convert it to rvalue.
2409224094
if (!D.AllocatorTraits)
2409324095
AllocatorExpr = SemaRef.DefaultLvalueConversion(AllocatorExpr).get();

clang/test/OpenMP/target_uses_allocators_messages.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ int main(int argc, char **argv) {
6262
#else
6363
#pragma omp target teams uses_allocators(traits(my_traits): my_alloc; traits(aligned_traits): aligned_alloc)
6464
{}
65+
#pragma omp target teams uses_allocators(my_alloc)
66+
{}
6567
#pragma omp target teams uses_allocators(traits(my_traits): my_alloc, traits(aligned_traits): aligned_alloc) // omp52-error {{',' not allowed as separator in 'uses_allocators' clause, use ';' instead}}
6668
{}
6769
#pragma omp target teams uses_allocators(my_alloc(my_traits), aligned_alloc(aligned_traits)) // omp52-warning {{old syntax 'allocator(expr)' on 'uses_allocators' clause was deprecated, use new syntax 'traits(expr): alloc'}} //omp52-warning {{old syntax 'allocator(expr)' on 'uses_allocators' clause was deprecated, use new syntax 'traits(expr): alloc'}}

0 commit comments

Comments
 (0)