public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/90493] const variable template specialization is always local
       [not found] <bug-90493-4@http.gcc.gnu.org/bugzilla/>
@ 2021-08-23  9:55 ` pinskia at gcc dot gnu.org
  2021-08-23 11:35 ` redi at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-23  9:55 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2021-08-23

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed.

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

* [Bug c++/90493] const variable template specialization is always local
       [not found] <bug-90493-4@http.gcc.gnu.org/bugzilla/>
  2021-08-23  9:55 ` [Bug c++/90493] const variable template specialization is always local pinskia at gcc dot gnu.org
@ 2021-08-23 11:35 ` redi at gcc dot gnu.org
  2021-08-23 15:11 ` herring at lanl dot gov
  2021-08-23 15:24 ` redi at gcc dot gnu.org
  3 siblings, 0 replies; 4+ messages in thread
From: redi at gcc dot gnu.org @ 2021-08-23 11:35 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=96523

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to S. Davis Herring from comment #1)
> It's already wrong for
> 
> template <typename T> const int foo = 42;
> 
> to produce internal linkage; [basic.link]/5.2 excludes variable templates
> from the rule that const implies static.  See also CWG1713.

That's PR 96523.

Reduced to show just the rejects-valid part:

template <typename T> extern const int foo = 41;
// this is an error:
// error: explicit template specialization cannot have a storage class
template <> extern const int foo<int> = 42;

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

* [Bug c++/90493] const variable template specialization is always local
       [not found] <bug-90493-4@http.gcc.gnu.org/bugzilla/>
  2021-08-23  9:55 ` [Bug c++/90493] const variable template specialization is always local pinskia at gcc dot gnu.org
  2021-08-23 11:35 ` redi at gcc dot gnu.org
@ 2021-08-23 15:11 ` herring at lanl dot gov
  2021-08-23 15:24 ` redi at gcc dot gnu.org
  3 siblings, 0 replies; 4+ messages in thread
From: herring at lanl dot gov @ 2021-08-23 15:11 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from S. Davis Herring <herring at lanl dot gov> ---
(In reply to Jonathan Wakely from comment #3)
> Reduced to show just the rejects-valid part:
> 
> template <typename T> extern const int foo = 41;
> // this is an error:
> // error: explicit template specialization cannot have a storage class
> template <> extern const int foo<int> = 42;

This code is ill-formed ([temp.expl.spec]/2) and is nonsensical because linkage
doesn't pertain to template specializations ([temp.type]/1).  (Obviously at the
assembly level there are global and local symbols for certain template
specializations, but their status is determined by the linkage of the template
and sometimes by the template arguments.)

As such, I'm not sure this is distinct from 96523.

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

* [Bug c++/90493] const variable template specialization is always local
       [not found] <bug-90493-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2021-08-23 15:11 ` herring at lanl dot gov
@ 2021-08-23 15:24 ` redi at gcc dot gnu.org
  3 siblings, 0 replies; 4+ messages in thread
From: redi at gcc dot gnu.org @ 2021-08-23 15:24 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Ah yes, so it's a clang bug then. G++ and EDG reject it.

Great, let's close this, since we already have 96523 for the internal linkage
bug.

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

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

end of thread, other threads:[~2021-08-23 15:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-90493-4@http.gcc.gnu.org/bugzilla/>
2021-08-23  9:55 ` [Bug c++/90493] const variable template specialization is always local pinskia at gcc dot gnu.org
2021-08-23 11:35 ` redi at gcc dot gnu.org
2021-08-23 15:11 ` herring at lanl dot gov
2021-08-23 15:24 ` redi at gcc dot gnu.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).