45 lines · plain
1// RUN: %clang_cc1 -std=c++14 -fsyntax-only -verify %s2 3#include "Inputs/cuda.h"4 5template <typename T>6__global__ T foo() {7 // expected-note@-1 {{kernel function type 'T ()' must have void return type}}8}9 10void f0() {11 foo<void><<<0, 0>>>();12 foo<int><<<0, 0>>>();13 // expected-error@-1 {{no matching function for call to 'foo'}}14}15 16__global__ auto f1() {17}18 19__global__ auto f2(int x) {20 return x + 1;21 // expected-error@-2 {{kernel function type 'auto (int)' must have void return type}}22}23 24template <bool Cond, typename T = void> struct enable_if { typedef T type; };25template <typename T> struct enable_if<false, T> {};26 27template <int N>28__global__29auto bar() -> typename enable_if<N == 1>::type {30 // expected-note@-1 {{requirement '3 == 1' was not satisfied [with N = 3]}}31}32 33template <int N>34__global__35auto bar() -> typename enable_if<N == 2>::type {36 // expected-note@-1 {{requirement '3 == 2' was not satisfied [with N = 3]}}37}38 39void f3() {40 bar<1><<<0, 0>>>();41 bar<2><<<0, 0>>>();42 bar<3><<<0, 0>>>();43 // expected-error@-1 {{no matching function for call to 'bar'}}44}45