https://bugs.llvm.org/show_bug.cgi?id=42972
Bug ID: 42972
Summary: Declaration conflict between
__clang_cuda_math_forward_declares.h and libstdc++
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: CUDA
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected]
Tagged as cuda, but the problem may only reproduce from openmp.
The abs definition introduced in https://reviews.llvm.org/D62046 breaks
<iostream> and <algorithm> when mixed with libstdc++ 7.4 and openmp, e.g.
test.cpp:
`#include <iostream>`
~/llvm-install/bin/clang++ -std=c++11 -fopenmp
-fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target=nvptx64-nvidia-cuda
-march=sm_50 -nocudalib -o test.x test.cpp
abs returning a const value seems a bit weird, I don't follow the reasoning in
the diff that makes this necessary.
```
In file included from
/usr/lib/gcc/x86_64-linux-gnu/7.4.0/../../../../include/c++/7.4.0/algorithm:62:
In file included from
/usr/lib/gcc/x86_64-linux-gnu/7.4.0/../../../../include/c++/7.4.0/bits/stl_algo.h:59:
In file included from
/usr/lib/gcc/x86_64-linux-gnu/7.4.0/../../../../include/c++/7.4.0/cstdlib:77:
/usr/lib/gcc/x86_64-linux-gnu/7.4.0/../../../../include/c++/7.4.0/bits/std_abs.h:70:3:
error:
declaration conflicts with target of using declaration already in scope
abs(double __x)
^
/home/jon/llvm-install/lib/clang/10.0.0/include/__clang_cuda_math_forward_declares.h:50:25:
note:
target of using declaration
__DEVICE__ const double abs(const double);
^
/usr/lib/gcc/x86_64-linux-gnu/7.4.0/../../../../include/c++/7.4.0/bits/std_abs.h:52:11:
note: using
declaration
using ::abs;
^
/usr/lib/gcc/x86_64-linux-gnu/7.4.0/../../../../include/c++/7.4.0/bits/std_abs.h:74:3:
error:
declaration conflicts with target of using declaration already in scope
abs(float __x)
^
/home/jon/llvm-install/lib/clang/10.0.0/include/__clang_cuda_math_forward_declares.h:51:24:
note:
target of using declaration
__DEVICE__ const float abs(const float);
^
/usr/lib/gcc/x86_64-linux-gnu/7.4.0/../../../../include/c++/7.4.0/bits/std_abs.h:52:11:
note: using
declaration
using ::abs;
^
2 errors generated.
```
--
You are receiving this mail because:
You are on the CC list for the bug._______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs