brintos

brintos / llvm-project-archived public Read only

0
0
Text · 981 B · dcbcef4 Raw
27 lines · cpp
1// RUN: %clang_cc1 -triple=x86_64-pc-win32 -fsyntax-only -fblocks -fcxx-exceptions -fms-extensions -verify -Wfunction-effects %s2 3#pragma clang diagnostic ignored "-Wperf-constraint-implies-noexcept"4 5// These need '-fms-extensions' (and maybe '-fdeclspec')6void f1() [[clang::nonblocking]] {7    __try {} __except (1) {} // expected-warning {{function with 'nonblocking' attribute must not throw or catch exceptions}}8}9 10struct 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 21void 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}27