no-host-device-constexpr.cu 673 B

1234567891011121314151617181920
  1. // RUN: %clang_cc1 -std=c++11 -fsyntax-only -fno-cuda-host-device-constexpr -verify %s
  2. // RUN: %clang_cc1 -std=c++11 -fsyntax-only -fno-cuda-host-device-constexpr -fcuda-is-device -verify %s
  3. #include "Inputs/cuda.h"
  4. // Check that, with -fno-cuda-host-device-constexpr, constexpr functions are
  5. // host-only, and __device__ constexpr functions are still device-only.
  6. constexpr int f() { return 0; } // expected-note {{not viable}}
  7. __device__ constexpr int g() { return 0; } // expected-note {{not viable}}
  8. void __device__ foo() {
  9. f(); // expected-error {{no matching function}}
  10. g();
  11. }
  12. void __host__ foo() {
  13. f();
  14. g(); // expected-error {{no matching function}}
  15. }