cuda-inherits-calling-conv.cu 1007 B

123456789101112131415161718192021222324252627282930
  1. // RUN: %clang_cc1 -std=c++11 -triple i386-windows-msvc \
  2. // RUN: -aux-triple nvptx-nvidia-cuda -fsyntax-only -verify %s
  3. // RUN: %clang_cc1 -std=c++11 -triple nvptx-nvidia-cuda \
  4. // RUN: -aux-triple i386-windows-msvc -fsyntax-only \
  5. // RUN: -fcuda-is-device -verify %s
  6. // RUN: %clang_cc1 -std=c++11 -triple nvptx-nvidia-cuda \
  7. // RUN: -aux-triple x86_64-linux-gnu -fsyntax-only \
  8. // RUN: -fcuda-is-device -verify -verify-ignore-unexpected=note \
  9. // RUN: -DEXPECT_ERR %s
  10. // CUDA device code should inherit the host's calling conventions.
  11. template <class T>
  12. struct Foo;
  13. template <class T>
  14. struct Foo<T()> {};
  15. // On x86_64-linux-gnu, this is a redefinition of the template, because the
  16. // __fastcall calling convention doesn't exist (and is therefore ignored).
  17. #ifndef EXPECT_ERR
  18. // expected-no-diagnostics
  19. #else
  20. // expected-error@+4 {{redefinition of 'Foo}}
  21. // expected-warning@+3 {{'__fastcall' calling convention is not supported}}
  22. #endif
  23. template <class T>
  24. struct Foo<T __fastcall()> {};