xref: /llvm-project/clang/test/SemaCXX/attr-extension-diags.cpp (revision a18632adc884397e0cd7f27bdb8ea3a822b63000)
1 // RUN: %clang_cc1 -std=c++11 -verify=ext -fsyntax-only -Wfuture-attribute-extensions %s
2 // RUN: %clang_cc1 -std=c++11 -verify -fsyntax-only -Wno-future-attribute-extensions %s
3 // RUN: %clang_cc1 -std=c++11 -verify -fsyntax-only -Wno-c++14-attribute-extensions -Wno-c++17-attribute-extensions -Wno-c++20-attribute-extensions %s
4 
5 // expected-no-diagnostics
6 
7 [[deprecated]] int func1(); // ext-warning {{use of the 'deprecated' attribute is a C++14 extension}}
8 [[deprecated("msg")]] int func2(); // ext-warning {{use of the 'deprecated' attribute is a C++14 extension}}
9 
10 [[nodiscard]] int func3(); // ext-warning {{use of the 'nodiscard' attribute is a C++17 extension}}
11 [[nodiscard("msg")]] int func4(); // ext-warning {{use of the 'nodiscard' attribute is a C++20 extension}}
12 
func5()13 void func5() {
14   if (true) [[likely]]; // ext-warning {{use of the 'likely' attribute is a C++20 extension}}
15 }
16