mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-16 22:36:34 +00:00

When new operator is called in OpenMP parallel region, delete operator is resolved and checked. Due to similar issue fixed by https://reviews.llvm.org/D121765, when resolving delete operator, the caller was not determined correctly, which results in error as shown in https://godbolt.org/z/jKhd8qKos. This patch fixes the issue in a similar way as https://reviews.llvm.org/D121765 Reviewed by: Artem Belevich Differential Revision: https://reviews.llvm.org/D123976
25 lines
752 B
Plaintext
25 lines
752 B
Plaintext
// RUN: %clang_cc1 -fopenmp -fsyntax-only -verify %s
|
|
// RUN: %clang_cc1 -fopenmp -fexceptions -fsyntax-only -verify %s
|
|
|
|
#include "Inputs/cuda.h"
|
|
|
|
__device__ void foo(int) {} // expected-note {{candidate function not viable: call to __device__ function from __host__ function}}
|
|
// expected-note@-1 {{'foo' declared here}}
|
|
|
|
int main() {
|
|
#pragma omp parallel
|
|
for (int i = 0; i < 100; i++) {
|
|
foo(1); // expected-error {{no matching function for call to 'foo'}}
|
|
new int;
|
|
}
|
|
|
|
auto Lambda = []() {
|
|
#pragma omp parallel
|
|
for (int i = 0; i < 100; i++) {
|
|
foo(1); // expected-error {{reference to __device__ function 'foo' in __host__ __device__ function}}
|
|
new int;
|
|
}
|
|
};
|
|
Lambda(); // expected-note {{called by 'main'}}
|
|
}
|