blob: 9ed9b6977202ca18761c0281e9954716430319ea [file] [log] [blame]
Justin Lebar2a8db342016-09-28 22:45:54 +00001// RUN: %clang_cc1 -fcxx-exceptions -fcuda-is-device -fsyntax-only -verify %s
2// RUN: %clang_cc1 -fcxx-exceptions -fsyntax-only -verify %s
3
4#include "Inputs/cuda.h"
5
6void host() {
7 throw NULL;
8 try {} catch(void*) {}
9}
10__device__ void device() {
11 throw NULL;
Justin Lebar179bdce2016-10-13 18:45:08 +000012 // expected-error@-1 {{cannot use 'throw' in __device__ function}}
Justin Lebar2a8db342016-09-28 22:45:54 +000013 try {} catch(void*) {}
Justin Lebar179bdce2016-10-13 18:45:08 +000014 // expected-error@-1 {{cannot use 'try' in __device__ function}}
Justin Lebar2a8db342016-09-28 22:45:54 +000015}
16__global__ void kernel() {
17 throw NULL;
Justin Lebar179bdce2016-10-13 18:45:08 +000018 // expected-error@-1 {{cannot use 'throw' in __global__ function}}
Justin Lebar2a8db342016-09-28 22:45:54 +000019 try {} catch(void*) {}
Justin Lebar179bdce2016-10-13 18:45:08 +000020 // expected-error@-1 {{cannot use 'try' in __global__ function}}
Justin Lebar2a8db342016-09-28 22:45:54 +000021}