diff options
author | Justin Lebar <jlebar@google.com> | 2016-10-19 00:06:49 +0000 |
---|---|---|
committer | Justin Lebar <jlebar@google.com> | 2016-10-19 00:06:49 +0000 |
commit | d3fd70dedd75f9b27f7198840a1ada82d54b95ab (patch) | |
tree | 13643e417a8d8d574929e75251dfce4f61a47bf9 /clang/test/SemaCUDA/implicit-device-lambda.cu | |
parent | b47711ab274e2de40e014dc72d9d87f884a893d7 (diff) | |
download | bcm5719-llvm-d3fd70dedd75f9b27f7198840a1ada82d54b95ab.tar.gz bcm5719-llvm-d3fd70dedd75f9b27f7198840a1ada82d54b95ab.zip |
[CUDA] Rework tests now that we emit deferred diagnostics during sema. Test-only change.
Summary:
Previously we had to split out a lot of our tests into a test that
checked only immediate errors and a test that checked only deferred
errors. This was because, if you emitted any immediate errors, we
wouldn't run codegen, where the deferred errors were emitted.
We've fixed this, and now emit deferred errors during sema. This lets
us merge a bunch of tests, and lets us convert some other tests to
-fsyntax-only.
Reviewers: tra
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D25755
llvm-svn: 284553
Diffstat (limited to 'clang/test/SemaCUDA/implicit-device-lambda.cu')
-rw-r--r-- | clang/test/SemaCUDA/implicit-device-lambda.cu | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/clang/test/SemaCUDA/implicit-device-lambda.cu b/clang/test/SemaCUDA/implicit-device-lambda.cu index be1babe8229..8e5b7ddddb8 100644 --- a/clang/test/SemaCUDA/implicit-device-lambda.cu +++ b/clang/test/SemaCUDA/implicit-device-lambda.cu @@ -76,6 +76,26 @@ __host__ void host_fn() { f4(); } +__host__ __device__ void hd_fn() { + auto f1 = [&] {}; + f1(); // implicitly __host__ __device__ + + auto f2 = [&] __device__ {}; + f2(); +#ifndef __CUDA_ARCH__ + // expected-error@-2 {{reference to __device__ function}} +#endif + + auto f3 = [&] __host__ {}; + f3(); +#ifdef __CUDA_ARCH__ + // expected-error@-2 {{reference to __host__ function}} +#endif + + auto f4 = [&] __host__ __device__ {}; + f4(); +} + // The special treatment above only applies to lambdas. __device__ void foo() { struct X { |