public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/52995] New: Change in the handling of templates and visibility attributes
@ 2012-04-15 11:57 rafael.espindola at gmail dot com
  2012-04-15 12:19 ` [Bug c++/52995] " redi at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: rafael.espindola at gmail dot com @ 2012-04-15 11:57 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 52995
           Summary: Change in the handling of templates and visibility
                    attributes
    Classification: Unclassified
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: rafael.espindola@gmail.com


in
-----------------------
#define HIDDEN __attribute__((visibility("hidden")))
#define DEFAULT __attribute__((visibility("default")))

template <class T> struct HIDDEN A {
  static void DEFAULT bar();
};
struct HIDDEN H;
struct DEFAULT D;

void test() {
  A<D>::bar(); // default                                                       
  A<H>::bar(); // hidden                                                        
}
------------------------

gcc 4.5 would produce two default symbols (_ZN1AI1DE3barEv and
_ZN1AI1HE3barEv). Gcc 4.7 makes _ZN1AI1HE3barEv hidden.

I can't see why the hidden template argument should make A<H> "more hidden"
than A<D>.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/52995] Change in the handling of templates and visibility attributes
  2012-04-15 11:57 [Bug c++/52995] New: Change in the handling of templates and visibility attributes rafael.espindola at gmail dot com
@ 2012-04-15 12:19 ` redi at gcc dot gnu.org
  2012-04-15 12:29 ` rafael.espindola at gmail dot com
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: redi at gcc dot gnu.org @ 2012-04-15 12:19 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|unknown                     |4.7.0

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-04-15 12:19:30 UTC ---
http://gcc.gnu.org/gcc-4.7/changes.html
"The ELF symbol visibility of a template instantiation is now properly
constrained by the visibility of its template arguments (bug c++/35688)."


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/52995] Change in the handling of templates and visibility attributes
  2012-04-15 11:57 [Bug c++/52995] New: Change in the handling of templates and visibility attributes rafael.espindola at gmail dot com
  2012-04-15 12:19 ` [Bug c++/52995] " redi at gcc dot gnu.org
@ 2012-04-15 12:29 ` rafael.espindola at gmail dot com
  2012-04-19  6:03 ` rafael.espindola at gmail dot com
  2012-10-16 22:43 ` paolo.carlini at oracle dot com
  3 siblings, 0 replies; 5+ messages in thread
From: rafael.espindola at gmail dot com @ 2012-04-15 12:29 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Rafael Avila de Espindola <rafael.espindola at gmail dot com> 2012-04-15 12:28:44 UTC ---
(In reply to comment #1)
> http://gcc.gnu.org/gcc-4.7/changes.html
> "The ELF symbol visibility of a template instantiation is now properly
> constrained by the visibility of its template arguments (bug c++/35688)."

I agree that a hidden type H should make A<H> hidden. The problem with this
example is that A is already declared hidden. I can see an argument for both
_ZN1AI1DE3barEv and _ZN1AI1HE3barEv to be hidden or default, but it is really
strange to change only one of them.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/52995] Change in the handling of templates and visibility attributes
  2012-04-15 11:57 [Bug c++/52995] New: Change in the handling of templates and visibility attributes rafael.espindola at gmail dot com
  2012-04-15 12:19 ` [Bug c++/52995] " redi at gcc dot gnu.org
  2012-04-15 12:29 ` rafael.espindola at gmail dot com
@ 2012-04-19  6:03 ` rafael.espindola at gmail dot com
  2012-10-16 22:43 ` paolo.carlini at oracle dot com
  3 siblings, 0 replies; 5+ messages in thread
From: rafael.espindola at gmail dot com @ 2012-04-19  6:03 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Rafael Avila de Espindola <rafael.espindola at gmail dot com> 2012-04-19 06:00:59 UTC ---
This just got discussed on the clang list. In the end we implemented what gcc
does. The winning argument was that it is not just the class that is templated,
but its members too. If a template argument can change the visibility of a
class, it should have the same power over its members.

My suggestion is to close this bug and mark it as working as intended, but I
will leave it open for the week in case someone else wants to comment.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/52995] Change in the handling of templates and visibility attributes
  2012-04-15 11:57 [Bug c++/52995] New: Change in the handling of templates and visibility attributes rafael.espindola at gmail dot com
                   ` (2 preceding siblings ...)
  2012-04-19  6:03 ` rafael.espindola at gmail dot com
@ 2012-10-16 22:43 ` paolo.carlini at oracle dot com
  3 siblings, 0 replies; 5+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-10-16 22:43 UTC (permalink / raw)
  To: gcc-bugs


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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID

--- Comment #4 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-10-16 22:43:18 UTC ---
Closing then.


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-10-16 22:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-15 11:57 [Bug c++/52995] New: Change in the handling of templates and visibility attributes rafael.espindola at gmail dot com
2012-04-15 12:19 ` [Bug c++/52995] " redi at gcc dot gnu.org
2012-04-15 12:29 ` rafael.espindola at gmail dot com
2012-04-19  6:03 ` rafael.espindola at gmail dot com
2012-10-16 22:43 ` paolo.carlini at oracle dot com

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).