[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / Parser / stmt-attributes.cpp
blob839c44e908af0de59215a186aa00a86e3ee0e627
1 // RUN: %clang_cc1 -std=c++11 -fcxx-exceptions -fexceptions -fsyntax-only -verify %s
3 #if !__has_extension(statement_attributes_with_gnu_syntax)
4 #error "We should have statement attributes with GNU syntax support"
5 #endif
7 template <typename T = void>
8 class __attribute__((nomerge)) A {
9 // expected-error@-1 {{'nomerge' attribute only applies to functions, statements and variables}}
12 class B : public A<> {
13 public:
14 void bar();
17 void bar();
19 void foo(A<> *obj) {
20 __attribute__((nomerge)) static_cast<B *>(obj)->bar();
21 __attribute__((nomerge))[obj]() { static_cast<B *>(obj)->bar(); }
22 ();
23 __attribute__(()) try {
24 bar();
25 } catch (...) {