[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / SemaCXX / cxx2c-attributes.cpp
blobc20a1b606a0fd99c20ac5ca24842af9e4e07a7a9
1 // RUN: %clang_cc1 %s -x c++ -std=c++11 -triple x86_64-pc-linux -fsyntax-only -verify -Wno-c++17-extensions
2 // RUN: %clang_cc1 %s -x c++ -std=c++11 -triple x86_64-windows-msvc -fsyntax-only -verify=msvc -Wno-c++17-extensions
3 // expected-no-diagnostics
5 // Check we return non-zero values for supported attributes as per
6 // wg21.link/P2552
7 static_assert(__has_cpp_attribute(assume));
9 // The standard does not prescribe a behavior for [[carries_dependency]]
11 static_assert(__has_cpp_attribute(deprecated));
12 static_assert(__has_cpp_attribute(fallthrough));
13 static_assert(__has_cpp_attribute(likely));
14 static_assert(__has_cpp_attribute(unlikely));
15 static_assert(__has_cpp_attribute(maybe_unused));
16 static_assert(__has_cpp_attribute(nodiscard));
17 static_assert(__has_cpp_attribute(noreturn));
19 // We do not support [[no_unique_address]] in MSVC emulation mode
20 static_assert(__has_cpp_attribute(no_unique_address)); // msvc-error {{static assertion failed}}