Patchwork [C++] PR 30066

login
register
mail settings
Submitter Roberto Agostino Vitillo
Date Oct. 25, 2011, 7:07 a.m.
Message ID <49A56898-F089-438B-ADAC-541095E8A322@lbl.gov>
Download mbox | patch
Permalink /patch/121501/
State New
Headers show

Comments

Roberto Agostino Vitillo - Oct. 25, 2011, 7:07 a.m.
The new testcase:

Patch

Index: gcc/testsuite/g++.dg/ext/visibility/fvisibility-inlines-hidden-4.C
===================================================================
--- gcc/testsuite/g++.dg/ext/visibility/fvisibility-inlines-hidden-4.C	(revision 0)
+++ gcc/testsuite/g++.dg/ext/visibility/fvisibility-inlines-hidden-4.C	(revision 0)
@@ -0,0 +1,37 @@ 
+/* PR c++/30066: Test that -fvisibility-inlines-hidden affects functions. */
+/* { dg-do compile } */
+/* { dg-require-visibility "" } */
+/* { dg-options "-fvisibility-inlines-hidden" } */
+/* { dg-final { scan-hidden "_Z3barv" } } */
+/* { dg-final { scan-not-hidden "_ZZ3barvE1n" } } */
+/* { dg-final { scan-not-hidden "_Z3fooIiEvv" } } */
+/* { dg-final { scan-hidden "_Z3fooIvEvv" } } */
+/* { dg-final { scan-hidden "_ZZN1A5innerEvE1n" } } */
+
+inline int * bar()
+{
+  static int n;
+  return &n;
+}
+
+template <class T>
+inline void foo() { }
+
+template void foo<int>();
+
+namespace A __attribute__ ((visibility ("hidden")))
+{
+  inline int * inner()
+  {
+    static int n;
+    return &n;
+  }
+}
+
+int main(void)
+{
+  bar();
+  foo<void>();
+  A::inner();
+  return 0;
+}