aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorNathaniel Shead <nathanieloshead@gmail.com>2023-11-15 20:50:53 +1100
committerNathaniel Shead <nathanieloshead@gmail.com>2023-11-25 00:55:15 +1100
commit726723c476800285cfbdfce612cedde4a9a7ad58 (patch)
tree10918be4ef394341f17fa2c39573dbaae01e1a42 /gcc/cp
parentaea337cf740ec33022f3cabfa7dd4333d5ba78ee (diff)
downloadgcc-726723c476800285cfbdfce612cedde4a9a7ad58.zip
gcc-726723c476800285cfbdfce612cedde4a9a7ad58.tar.gz
gcc-726723c476800285cfbdfce612cedde4a9a7ad58.tar.bz2
c++: Allow exporting const-qualified namespace-scope variables [PR99232]
By [basic.link] p3.2.1, a non-template non-volatile const-qualified variable is not necessarily internal linkage in a module declaration, and rather may have module linkage (or external linkage if it is exported, see p4.8). PR c++/99232 gcc/cp/ChangeLog: * decl.cc (grokvardecl): Don't mark variables attached to modules as internal. gcc/testsuite/ChangeLog: * g++.dg/modules/pr99232_a.C: New test. * g++.dg/modules/pr99232_b.C: New test. Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/decl.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/gcc/cp/decl.cc b/gcc/cp/decl.cc
index 16b04eb..ed14015 100644
--- a/gcc/cp/decl.cc
+++ b/gcc/cp/decl.cc
@@ -11006,7 +11006,8 @@ grokvardecl (tree type,
&& (DECL_THIS_EXTERN (decl)
|| ! constp
|| volatilep
- || inlinep));
+ || inlinep
+ || module_attach_p ()));
TREE_STATIC (decl) = ! DECL_EXTERNAL (decl);
}
/* Not at top level, only `static' makes a static definition. */