[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / Parser / using-if-exists-attr.cpp
blobba34b9beb6bc41830a51a325fc2c74a757b3f7c0
1 // RUN: %clang_cc1 -std=c++20 -fsyntax-only %s -pedantic -verify
3 #define UIE __attribute__((using_if_exists))
5 namespace NS {
6 typedef int x;
9 using NS::x __attribute__((using_if_exists));
11 using NS::x [[clang::using_if_exists]]; // expected-warning{{ISO C++ does not allow an attribute list to appear here}}
13 [[clang::using_if_exists]] // expected-warning{{ISO C++ does not allow an attribute list to appear here}}
14 using NS::not_there,
15 NS::not_there2;
17 using NS::not_there3, // expected-error {{no member named 'not_there3' in namespace 'NS'}}
18 NS::not_there4 [[clang::using_if_exists]]; // expected-warning{{C++ does not allow an attribute list to appear here}}
20 [[clang::using_if_exists]] using NS::not_there5 [[clang::using_if_exists]]; // expected-warning 2 {{ISO C++ does not allow}}
22 struct Base {};
23 struct Derived : Base {
24 [[clang::using_if_exists]] using Base::x; // expected-warning {{ISO C++ does not allow an attribute list to appear here}}
25 using Base::y [[clang::using_if_exists]]; // expected-warning {{ISO C++ does not allow an attribute list to appear here}}
26 [[clang::using_if_exists]] using Base::z, Base::q; // expected-warning {{C++ does not allow an attribute list to appear here}}