Debian Codegraph @

clang/test/Sema/attr-nonblocking-constraints-ms.cpp

raw
1 // RUN: %clang_cc1 -triple=x86_64-pc-win32 -fsyntax-only -fblocks -fcxx-exceptions -fms-extensions -verify -Wfunction-effects %s
2
3 #pragma clang diagnostic ignored "-Wperf-constraint-implies-noexcept"
4
5 // These need '-fms-extensions' (and maybe '-fdeclspec')
6 void f1() [[clang::nonblocking]] {
7 __try {} __except (1) {} // expected-warning {{function with 'nonblocking' attribute must not throw or catch exceptions}}
8 }
9
10 struct S {
11 int get_x(); // expected-note {{declaration cannot be inferred 'nonblocking' because it has no definition in this translation unit}}
12 __declspec(property(get = get_x)) int x;
13
14 int get_nb() { return 42; }
15 __declspec(property(get = get_nb)) int nb;
16
17 int get_nb2() [[clang::nonblocking]];
18 __declspec(property(get = get_nb2)) int nb2;
19 };
20
21 void f2() [[clang::nonblocking]] {
22 S a;
23 a.x; // expected-warning {{function with 'nonblocking' attribute must not call non-'nonblocking' function 'S::get_x'}}
24 a.nb;
25 a.nb2;
26 }