[clang] [clang][OpenMP] Don't declare HIP's ::min and ::max in an OpenMP TU (PR #225162)
Joseph Huber via cfe-commits
cfe-commits at lists.llvm.org
Thu Oct 29 08:48:20 PDT 2026
================
@@ -0,0 +1,16 @@
+// RUN: %clang_cc1 -internal-isystem %S/../../lib/Headers/openmp_wrappers -include __clang_openmp_device_functions.h -internal-isystem %S/Inputs/include -x c++ -fopenmp -triple amdgpu-amd-amdhsa -aux-triple x86_64-unknown-unknown -fopenmp-targets=amdgpu-amd-amdhsa -fopenmp-is-target-device -fsyntax-only -verify %s
+
+// The OpenMP math wrapper pulls in __clang_hip_math.h, whose ::min and ::max
+// are a CUDA compatibility extension for HIP. In an OpenMP translation unit
+// these calls are ordinary unqualified C++ lookups and must resolve to std.
+
+// expected-no-diagnostics
+
+#include <algorithm>
+#include <cmath>
+
+using namespace std;
+
+long test_min(long __a, long __b) { return min(__a, __b); }
----------------
jhuber6 wrote:
Is there not an existing file this can go into?
https://github.com/llvm/llvm-project/pull/225162
More information about the cfe-commits
mailing list