1 // RUN: %clang_cc1 -fsyntax-only -fcuda-is-device -verify %s
3 #include "Inputs/cuda.h"
5 __device__ float f0(float) __attribute__((noconvergent));
6 __device__ __attribute__((noconvergent)) float f1(float);
7 [[clang::noconvergent]] __device__ float f2(float);
9 __device__ [[clang::noconvergent(1)]] float f3(float);
10 // expected-error@-1 {{'noconvergent' attribute takes no arguments}}
12 __device__ [[clang::noconvergent]] float g0;
13 // expected-warning@-1 {{'noconvergent' attribute only applies to functions and statements}}
15 __device__ __attribute__((convergent)) __attribute__((noconvergent)) float f4(float);
16 // expected-error@-1 {{'noconvergent' and 'convergent' attributes are not compatible}}
17 // expected-note@-2 {{conflicting attribute is here}}
19 __device__ [[clang::noconvergent]] float f5(float);
20 __device__ [[clang::convergent]] float f5(float);
21 // expected-error@-1 {{'convergent' and 'noconvergent' attributes are not compatible}}
22 // expected-note@-3 {{conflicting attribute is here}}
24 __device__ float f5(float x) {
25 [[clang::noconvergent]] float y;
26 // expected-warning@-1 {{'noconvergent' attribute only applies to functions and statements}}
30 [[clang::noconvergent]] z = 1;
31 // expected-warning@-1 {{'noconvergent' attribute is ignored because there exists no call expression inside the statement}}
33 [[clang::noconvergent]] z = f0(x);