public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/106023] New: Would like to control the ELF visibility of template explicit instantiations
@ 2022-06-18 15:16 thiago at kde dot org
  2022-06-18 20:06 ` [Bug c++/106023] " pinskia at gcc dot gnu.org
  2022-06-19 16:04 ` thiago at kde dot org
  0 siblings, 2 replies; 3+ messages in thread
From: thiago at kde dot org @ 2022-06-18 15:16 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106023

            Bug ID: 106023
           Summary: Would like to control the ELF visibility of template
                    explicit instantiations
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: thiago at kde dot org
  Target Milestone: ---

Given a template like:

template <typename T> struct __attribute__((visibility("hidden"))) S
{
    static constexpr int n = 0;
};

I would like to mark an explicit instantiation (not a specialisation!) with a
different visibility:

template struct __attribute__((visibility("default"))) S<int>;
template __attribute__((visibility("default"))) const int S<unsigned>::n;

Either solution would help me, but the first would be preferable. Both would be
best.

Clang does support both forms properly. Visual Studio supports the former only.
See https://gcc.godbolt.org/z/T7sdzTnbG and note how GCC adds ".hidden" to the
two "::n" symbols and Clang doesn't, while Clang properly refers to those
symbols using @GOTPCREL and GCC doesn't. The MVSC example uses dllimport only
to highlight the difference; it wouldn't be written like this in real code.

Please ensure "protected" visibility also works. See
https://gcc.godbolt.org/z/o3W4x5YsG

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

* [Bug c++/106023] Would like to control the ELF visibility of template explicit instantiations
  2022-06-18 15:16 [Bug c++/106023] New: Would like to control the ELF visibility of template explicit instantiations thiago at kde dot org
@ 2022-06-18 20:06 ` pinskia at gcc dot gnu.org
  2022-06-19 16:04 ` thiago at kde dot org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-06-18 20:06 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106023

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Depends on|                            |77306

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I think this is a dup of bug 77306.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77306
[Bug 77306] Unable to specify visibility for explicit template instantiations

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

* [Bug c++/106023] Would like to control the ELF visibility of template explicit instantiations
  2022-06-18 15:16 [Bug c++/106023] New: Would like to control the ELF visibility of template explicit instantiations thiago at kde dot org
  2022-06-18 20:06 ` [Bug c++/106023] " pinskia at gcc dot gnu.org
@ 2022-06-19 16:04 ` thiago at kde dot org
  1 sibling, 0 replies; 3+ messages in thread
From: thiago at kde dot org @ 2022-06-19 16:04 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106023

Thiago Macieira <thiago at kde dot org> changed:

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

--- Comment #2 from Thiago Macieira <thiago at kde dot org> ---
Ah, so it is. Thanks for putting up with my being lazy.

*** This bug has been marked as a duplicate of bug 77306 ***

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

end of thread, other threads:[~2022-06-19 16:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-18 15:16 [Bug c++/106023] New: Would like to control the ELF visibility of template explicit instantiations thiago at kde dot org
2022-06-18 20:06 ` [Bug c++/106023] " pinskia at gcc dot gnu.org
2022-06-19 16:04 ` thiago at kde dot org

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