[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / SemaCXX / attr-reinitializes.cpp
blob129d359b8b7424d1dd05593e0ee2e1fcbeb7bea1
1 // RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
3 [[clang::reinitializes]] int a; // expected-error {{'reinitializes' attribute only applies to non-static non-const member functions}}
5 [[clang::reinitializes]] void f(); // expected-error {{only applies to}}
7 struct A {
8 [[clang::reinitializes]] void foo();
9 __attribute__((reinitializes)) void gnu_foo();
10 [[clang::reinitializes]] void bar() const; // expected-error {{only applies to}}
11 [[clang::reinitializes]] static void baz(); // expected-error {{only applies to}}
12 [[clang::reinitializes]] int a; // expected-error {{only applies to}}
14 [[clang::reinitializes("arg")]] void qux(); // expected-error {{'reinitializes' attribute takes no arguments}}