28 lines · cpp
1// RUN: %clang_cc1 -std=c++20 -fsyntax-only %s -pedantic -verify2 3#define UIE __attribute__((using_if_exists))4 5namespace NS {6typedef int x;7}8 9using NS::x __attribute__((using_if_exists));10 11using NS::x [[clang::using_if_exists]]; // expected-warning{{ISO C++ does not allow an attribute list to appear here}}12 13[[clang::using_if_exists]] // expected-warning{{ISO C++ does not allow an attribute list to appear here}}14using NS::not_there,15 NS::not_there2;16 17using 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}}19 20[[clang::using_if_exists]] using NS::not_there5 [[clang::using_if_exists]]; // expected-warning 2 {{ISO C++ does not allow}}21 22struct Base {};23struct 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}}27};28