aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2024-08-07 19:08:07 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2024-08-07 19:08:07 +0200
commit82cd63a63eaa61a4ed5c4029a1869be7446ecb3c (patch)
treeea6bc7b14bcb893c669a7e7d704d1a5dfd22a29f /gcc/cp
parent2c6174402ea315ecf618cfcba741e8cb18bc5282 (diff)
downloadgcc-82cd63a63eaa61a4ed5c4029a1869be7446ecb3c.zip
gcc-82cd63a63eaa61a4ed5c4029a1869be7446ecb3c.tar.gz
gcc-82cd63a63eaa61a4ed5c4029a1869be7446ecb3c.tar.bz2
c++: Implement CWG2387 - Linkage of const-qualified variable template [PR109126]
The following patch attempts to implement DR2387 by making variable templates including their specialization TREE_PUBLIC when at file scope and they don't have static storage class. 2024-08-07 Jakub Jelinek <jakub@redhat.com> PR c++/109126 * decl.cc (grokvardecl): Implement CWG 2387 - Linkage of const-qualified variable template. Set TREE_PUBLIC on variable templates with const qualified types unless static is present. * g++.dg/DRs/dr2387.C: New test. * g++.dg/DRs/dr2387-aux.cc: New file.
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/decl.cc2
1 files changed, 2 insertions, 0 deletions
diff --git a/gcc/cp/decl.cc b/gcc/cp/decl.cc
index 86d2bfa..a468bfd 100644
--- a/gcc/cp/decl.cc
+++ b/gcc/cp/decl.cc
@@ -11225,6 +11225,8 @@ grokvardecl (tree type,
|| ! constp
|| volatilep
|| inlinep
+ || in_template_context
+ || processing_specialization
|| module_attach_p ()));
TREE_STATIC (decl) = ! DECL_EXTERNAL (decl);
}