Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions clang/docs/ReleaseNotes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,8 @@ CUDA/HIP Language Changes
CUDA Support
^^^^^^^^^^^^

Support calling `consteval` function between different target.

AIX Support
^^^^^^^^^^^

Expand Down
3 changes: 3 additions & 0 deletions clang/lib/Sema/SemaCUDA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,9 @@ CUDAFunctionTarget SemaCUDA::IdentifyTarget(const FunctionDecl *D,
if (D->hasAttr<CUDAGlobalAttr>())
return CUDAFunctionTarget::Global;

if (D->isConsteval())
return CUDAFunctionTarget::HostDevice;

if (hasAttr<CUDADeviceAttr>(D, IgnoreImplicitHDAttr)) {
if (hasAttr<CUDAHostAttr>(D, IgnoreImplicitHDAttr))
return CUDAFunctionTarget::HostDevice;
Expand Down
8 changes: 8 additions & 0 deletions clang/test/SemaCUDA/consteval-func.cu
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify %s

// expected-no-diagnostics

#include "Inputs/cuda.h"

__device__ consteval int f() { return 0; }
int main() { return f(); }