Clang Project

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