[cfe-users] Compiling CUDA does not define __CUDACC__

2019-10-02 Thread Edward Diener via cfe-users
According to 
https://llvm.org/docs/CompileCudaWithLLVM.html#detecting-clang-vs-nvcc-from-code 
if I compile a CUDA file then __CUDACC__ should be defined. I have this 
program as 'clang_cuda.cu':


#if !defined(__clang__)

#error Clang is not defined

#elif !defined(__CUDACC__)

#error __CUDACC__ is not defined

#elif !defined(__CUDA__)

#error __CUDA__ is not defined

#endif

int main(void) {
return 0;
}

which I compile with clang-9.0 targeting gcc on Windows with:

clang++ -c -m64 -O0 -fno-inline -Wall -g -pthread -target 
x86_64-pc-windows-gnu -nocudainc -nocudalib -x cuda -o clang_cuda.obj 
clang_cuda.cu


the program outputs the preprocessor error: __CUDACC__ is not defined

Why is this ?




___
cfe-users mailing list
cfe-users@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users


Re: [cfe-users] constexpr pointer-to-member-function broken in Clang 9?

2019-10-02 Thread Richard Smith via cfe-users
On Tue, 1 Oct 2019 at 10:42, Michael Price - Dev via cfe-users <
cfe-users@lists.llvm.org> wrote:

> Should this be ill-formed?
>
> struct C {
>   constexpr C() {}
>   constexpr bool f() const { return true; }
> };
> constexpr C c{};
>
> constexpr bool fails_9_0_0(const C* pc, bool (C::*pm)() const) {
>   return (pc->*pm)();
> }
> constexpr bool b = fails_9_0_0(&c, &C::f);
>
>
> Clang 9 produces a diagnostic stating “constexpr function never produces a
> constant expression” for `fails_9_0_0`. Works in Clang 8 as well as GCC and
> MSVC.
>

This was also filed as PR43519 and is now fixed in trunk.


> — Michael Price
>
> Sent from my iPhone
> ___
> cfe-users mailing list
> cfe-users@lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users
>
___
cfe-users mailing list
cfe-users@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users