xref: /aosp_15_r20/external/clang/test/SemaCXX/attr-notail.cpp (revision 67e74705e28f6214e480b399dd47ea732279e315)
1*67e74705SXin Li // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
2*67e74705SXin Li 
3*67e74705SXin Li class Base {
4*67e74705SXin Li public:
5*67e74705SXin Li   [[clang::not_tail_called]] virtual int foo1(); // expected-error {{'not_tail_called' attribute cannot be applied to virtual functions}}
6*67e74705SXin Li   virtual int foo2();
7*67e74705SXin Li   [[clang::not_tail_called]] int foo3();
~Base()8*67e74705SXin Li   virtual ~Base() {}
9*67e74705SXin Li };
10*67e74705SXin Li 
11*67e74705SXin Li class Derived1 : public Base {
12*67e74705SXin Li public:
13*67e74705SXin Li   int foo1() override;
14*67e74705SXin Li   [[clang::not_tail_called]] int foo2() override; // expected-error {{'not_tail_called' attribute cannot be applied to virtual functions}}
15*67e74705SXin Li   [[clang::not_tail_called]] int foo4();
16*67e74705SXin Li };
17