120039ae1d9f520d8395899d807473b638fb48688Rafael Espindola// RUN: %clang_cc1 -fsyntax-only -verify %s 220039ae1d9f520d8395899d807473b638fb48688Rafael Espindola 320039ae1d9f520d8395899d807473b638fb48688Rafael Espindolanamespace test1 __attribute__((visibility("hidden"))) { // expected-note{{surrounding namespace with visibility attribute starts here}} 420039ae1d9f520d8395899d807473b638fb48688Rafael Espindola#pragma GCC visibility pop // expected-error{{#pragma visibility pop with no matching #pragma visibility push}} 520039ae1d9f520d8395899d807473b638fb48688Rafael Espindola} 620039ae1d9f520d8395899d807473b638fb48688Rafael Espindola 720039ae1d9f520d8395899d807473b638fb48688Rafael Espindola// GCC 4.6 accepts this, but the "hidden" leaks past the namespace end. 820039ae1d9f520d8395899d807473b638fb48688Rafael Espindolanamespace test2 __attribute__((visibility("hidden"))) { 920039ae1d9f520d8395899d807473b638fb48688Rafael Espindola#pragma GCC visibility push(protected) // expected-error{{#pragma visibility push with no matching #pragma visibility pop}} 1020039ae1d9f520d8395899d807473b638fb48688Rafael Espindola} // expected-note{{surrounding namespace with visibility attribute ends here}} 1120039ae1d9f520d8395899d807473b638fb48688Rafael Espindola 1220039ae1d9f520d8395899d807473b638fb48688Rafael Espindola#pragma GCC visibility pop // expected-error{{#pragma visibility pop with no matching #pragma visibility push}} 13aa5ab26ed93382b812147f532dcbf4afb5494040Eli Friedman 14aa5ab26ed93382b812147f532dcbf4afb5494040Eli Friedman// <rdar://problem/10871094> 15aa5ab26ed93382b812147f532dcbf4afb5494040Eli Friedmanstruct A { 16aa5ab26ed93382b812147f532dcbf4afb5494040Eli Friedman #pragma GCC visibility push(protected) 17aa5ab26ed93382b812147f532dcbf4afb5494040Eli Friedman #pragma GCC visibility pop 18aa5ab26ed93382b812147f532dcbf4afb5494040Eli Friedman}; 19aa5ab26ed93382b812147f532dcbf4afb5494040Eli Friedman 20aa5ab26ed93382b812147f532dcbf4afb5494040Eli Friedmanvoid f() { 21aa5ab26ed93382b812147f532dcbf4afb5494040Eli Friedman #pragma GCC visibility push(protected) 22aa5ab26ed93382b812147f532dcbf4afb5494040Eli Friedman #pragma GCC visibility pop 23aa5ab26ed93382b812147f532dcbf4afb5494040Eli Friedman} 244bda1d8cfe7d42b2798a06d16a5b776d980aad5fRafael Espindola 254bda1d8cfe7d42b2798a06d16a5b776d980aad5fRafael Espindolanamespace pr13662 { 264bda1d8cfe7d42b2798a06d16a5b776d980aad5fRafael Espindola#pragma GCC visibility push(hidden) 274bda1d8cfe7d42b2798a06d16a5b776d980aad5fRafael Espindola template<class T> class __attribute__((__visibility__("default"))) foo; 284bda1d8cfe7d42b2798a06d16a5b776d980aad5fRafael Espindola class bar { template<class T> friend class foo; }; 294bda1d8cfe7d42b2798a06d16a5b776d980aad5fRafael Espindola#pragma GCC visibility pop 304bda1d8cfe7d42b2798a06d16a5b776d980aad5fRafael Espindola} 31