1*67e74705SXin Li // RUN: %clang_cc1 -fsyntax-only -verify %s 2*67e74705SXin Li 3*67e74705SXin Li namespace test1 __attribute__((visibility("hidden"))) { // expected-note{{surrounding namespace with visibility attribute starts here}} 4*67e74705SXin Li #pragma GCC visibility pop // expected-error{{#pragma visibility pop with no matching #pragma visibility push}} 5*67e74705SXin Li } 6*67e74705SXin Li 7*67e74705SXin Li // GCC 4.6 accepts this, but the "hidden" leaks past the namespace end. 8*67e74705SXin Li namespace test2 __attribute__((visibility("hidden"))) { 9*67e74705SXin Li #pragma GCC visibility push(protected) // expected-error{{#pragma visibility push with no matching #pragma visibility pop}} 10*67e74705SXin Li } // expected-note{{surrounding namespace with visibility attribute ends here}} 11*67e74705SXin Li 12*67e74705SXin Li #pragma GCC visibility pop // expected-error{{#pragma visibility pop with no matching #pragma visibility push}} 13*67e74705SXin Li 14*67e74705SXin Li // <rdar://problem/10871094> 15*67e74705SXin Li struct A { 16*67e74705SXin Li #pragma GCC visibility push(protected) 17*67e74705SXin Li #pragma GCC visibility pop 18*67e74705SXin Li }; 19*67e74705SXin Li f()20*67e74705SXin Livoid f() { 21*67e74705SXin Li #pragma GCC visibility push(protected) 22*67e74705SXin Li #pragma GCC visibility pop 23*67e74705SXin Li } 24*67e74705SXin Li 25*67e74705SXin Li namespace pr13662 { 26*67e74705SXin Li #pragma GCC visibility push(hidden) 27*67e74705SXin Li template<class T> class __attribute__((__visibility__("default"))) foo; 28*67e74705SXin Li class bar { template<class T> friend class foo; }; 29*67e74705SXin Li #pragma GCC visibility pop 30*67e74705SXin Li } 31