public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/96523] New: variable templates of constant types have incorrect linkage
@ 2020-08-07 14:59 nathan at gcc dot gnu.org
  2020-08-07 15:00 ` [Bug c++/96523] " nathan at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: nathan at gcc dot gnu.org @ 2020-08-07 14:59 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 96523
           Summary: variable templates of constant types have incorrect
                    linkage
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: nathan at gcc dot gnu.org
  Target Milestone: ---

Created attachment 49022
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49022&action=edit
testcase part 1

non-template namespace-scope variables of constant type get internal linkage. 
We're doing the same for template-variables, which is wrong.  The attached two
sources should link and run w/o error. The executable returns 2 as the two
instantiations of CONST each has internal linkage.

devvm293:110>./cc1plus var-1_a.C -quiet
devvm293:111>./cc1plus var-1_b.C -quiet
devvm293:112>g++ var-1_*.s
devvm293:113>./a.out                   
(2)devvm293:114>

[basic.link]/3:

A name having namespace scope (6.4.6) has internal linkage if it is the name of

(3.1) — a variable, variable template, function, or function template that is
explicitly declared static; or

(3.2) — a non-template variable of non-volatile const-qualified type, unless

...

[Note: An instantiated variable template that has const-qualified type can have
external or module linkage,
even if not declared extern. — end note]

working on a fix, but would like confirmation of bug

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

* [Bug c++/96523] variable templates of constant types have incorrect linkage
  2020-08-07 14:59 [Bug c++/96523] New: variable templates of constant types have incorrect linkage nathan at gcc dot gnu.org
@ 2020-08-07 15:00 ` nathan at gcc dot gnu.org
  2020-08-07 17:35 ` redi at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: nathan at gcc dot gnu.org @ 2020-08-07 15:00 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Nathan Sidwell <nathan at gcc dot gnu.org> ---
Created attachment 49023
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49023&action=edit
testcase part 2

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

* [Bug c++/96523] variable templates of constant types have incorrect linkage
  2020-08-07 14:59 [Bug c++/96523] New: variable templates of constant types have incorrect linkage nathan at gcc dot gnu.org
  2020-08-07 15:00 ` [Bug c++/96523] " nathan at gcc dot gnu.org
@ 2020-08-07 17:35 ` redi at gcc dot gnu.org
  2020-08-10 14:09 ` nathan at gcc dot gnu.org
  2021-08-23 15:24 ` redi at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: redi at gcc dot gnu.org @ 2020-08-07 17:35 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2020-08-07
             Status|UNCONFIRMED                 |NEW

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

* [Bug c++/96523] variable templates of constant types have incorrect linkage
  2020-08-07 14:59 [Bug c++/96523] New: variable templates of constant types have incorrect linkage nathan at gcc dot gnu.org
  2020-08-07 15:00 ` [Bug c++/96523] " nathan at gcc dot gnu.org
  2020-08-07 17:35 ` redi at gcc dot gnu.org
@ 2020-08-10 14:09 ` nathan at gcc dot gnu.org
  2021-08-23 15:24 ` redi at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: nathan at gcc dot gnu.org @ 2020-08-10 14:09 UTC (permalink / raw)
  To: gcc-bugs

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

Nathan Sidwell <nathan at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |nathan at gcc dot gnu.org

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

* [Bug c++/96523] variable templates of constant types have incorrect linkage
  2020-08-07 14:59 [Bug c++/96523] New: variable templates of constant types have incorrect linkage nathan at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2020-08-10 14:09 ` nathan at gcc dot gnu.org
@ 2021-08-23 15:24 ` redi at gcc dot gnu.org
  3 siblings, 0 replies; 5+ 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=96523

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rafael at espindo dot la

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
*** Bug 90493 has been marked as a duplicate of this bug. ***

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

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

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-07 14:59 [Bug c++/96523] New: variable templates of constant types have incorrect linkage nathan at gcc dot gnu.org
2020-08-07 15:00 ` [Bug c++/96523] " nathan at gcc dot gnu.org
2020-08-07 17:35 ` redi at gcc dot gnu.org
2020-08-10 14:09 ` nathan at gcc dot gnu.org
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).