public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "vincenzo.innocente at cern dot ch" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/35688] template visibility not overridden by template arguments
Date: Tue, 08 Nov 2011 08:53:00 -0000	[thread overview]
Message-ID: <bug-35688-4-i0sSFfSH39@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-35688-4@http.gcc.gnu.org/bugzilla/>

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35688

--- Comment #12 from vincenzo Innocente <vincenzo.innocente at cern dot ch> 2011-11-08 08:49:22 UTC ---
much better!
for the test in comment 7 now I get
c++ -O0 -shared -fPIC -fvisibility=hidden -o bha.so testICF.cpp 
nm bha.so | c++filt | grep " T "
0000000000000e5c T go()
00000000000069ce T unsigned long const& std::max<unsigned long>(unsigned long
const&, unsigned long const&)
00000000000010b2 T std::__lg(long)
00000000000010d8 T operator new(unsigned long, void*)

puzzled by the visibility of std::max above I modified the original test
further as

cat visTest.cc 
namespace s __attribute__((visibility("default"))) {
  template <class T>
    class vector {
  public:
    vector() { }
  };
  template <class T>
    void foo(T t) {
  }
}

class A {
public:
  A() { }
  s::vector<int> v;
};

s::vector<A> v;

int main() {
  A a;
  s::foo(a);
  s::foo(v);
  s::foo(a.v);

  return 0;
}


and I get default visibility for s::vector<int>, as expected. not necessarily
as wished…
In my opinion this is consistent with spec, expect bug reports though!

 c++ -O0 -shared -fPIC -fvisibility=hidden -o bha.so visTest.cc 
 nm bha.so | c++filt 
0000000000000d77 t __GLOBAL__sub_I_visTest.cc
0000000000000d4c t __static_initialization_and_destruction_0(int, int)
0000000000000d8c t A::A()
0000000000000dba t void s::foo<A>(A)
0000000000000dc0 t void s::foo<s::vector<A> >(s::vector<A>)
0000000000000dc6 T void s::foo<s::vector<int> >(s::vector<int>)
0000000000000db0 t s::vector<A>::vector()
0000000000000da6 T s::vector<int>::vector()
0000000000000d04 t __dyld_func_lookup
0000000000000d0a t _main
0000000000001038 d _v
                 U dyld_stub_binder
0000000000000cf0 t dyld_stub_binding_helper


p.s I verified that if "s" in NOT default visible  vector<int> will become
hidden


  parent reply	other threads:[~2011-11-08  8:50 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-35688-4@http.gcc.gnu.org/bugzilla/>
2010-10-27 22:10 ` [Bug c++/35688] template visibility botch pinskia at gcc dot gnu.org
2011-11-06 12:14 ` [Bug c++/35688] template visibility not overridden by template arguments paolo.carlini at oracle dot com
2011-11-06 13:20 ` jason at gcc dot gnu.org
2011-11-06 13:22 ` jason at gcc dot gnu.org
2011-11-06 20:37 ` jason at gcc dot gnu.org
2011-11-06 21:14 ` paolo.carlini at oracle dot com
2011-11-07  4:41 ` jason at gcc dot gnu.org
2011-11-07  9:24 ` vincenzo.innocente at cern dot ch
2011-11-07  9:39 ` vincenzo.innocente at cern dot ch
2011-11-07 17:55 ` jason at gcc dot gnu.org
2011-11-07 21:18 ` jason at gcc dot gnu.org
2011-11-07 21:25 ` jason at gcc dot gnu.org
2011-11-08  8:53 ` vincenzo.innocente at cern dot ch [this message]
2012-12-08 12:10 ` Woebbeking at web dot de
2013-02-10 15:50 ` Woebbeking at web dot de
2013-02-11 15:45 ` jason at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-35688-4-i0sSFfSH39@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).