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