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

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