view gcc/testsuite/g++.dg/ext/visibility/template2.C @ 158:494b0b89df80 default tip

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 25 May 2020 18:13:55 +0900
parents 04ced10e8804
children
line wrap: on
line source

// PR c++/27000
// Implicitly instantiated templates should not be affected by
// #pragma visibility.

/* { dg-do compile } */
/* { dg-require-visibility "" } */
/* { dg-final { scan-not-hidden "_ZN1SIiED1Ev" } } */
/* { dg-final { scan-not-hidden "_ZN1SIiEC1ERKi" } } */

template <class T>
struct S
{
  S (const T &);
  ~S ();
  T t;
};

template <class T>
S<T>::S (const T &x)
{
  t = x;
}

template <class T>
S<T>::~S ()
{
}

#pragma GCC visibility push(hidden)
struct U
{
  S<int> s;
  U () : s (6) { }
} u;
#pragma GCC visibility pop