aboutsummaryrefslogtreecommitdiff
path: root/gcc/attribs.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2019-03-09 13:08:23 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2019-03-09 13:08:23 +0100
commit3568d2d5fa77f5c8798c1dca46b1f738d2097202 (patch)
treeaa41e3327876f34e6b3f79db2fa22e61a1058305 /gcc/attribs.c
parent04e5c73db8b51c76bff5fb30553089ccfa7bb5fc (diff)
downloadgcc-3568d2d5fa77f5c8798c1dca46b1f738d2097202.zip
gcc-3568d2d5fa77f5c8798c1dca46b1f738d2097202.tar.gz
gcc-3568d2d5fa77f5c8798c1dca46b1f738d2097202.tar.bz2
re PR c/88568 ('dllimport' no longer implies 'extern' in C)
PR c/88568 * attribs.c (handle_dll_attribute): Don't clear TREE_STATIC for dllimport on VAR_DECLs with RECORD_TYPE or UNION_TYPE DECL_CONTEXT. * g++.dg/other/pr88568.C: New test. From-SVN: r269525
Diffstat (limited to 'gcc/attribs.c')
-rw-r--r--gcc/attribs.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/gcc/attribs.c b/gcc/attribs.c
index a55638d..adf4973 100644
--- a/gcc/attribs.c
+++ b/gcc/attribs.c
@@ -1691,8 +1691,11 @@ handle_dll_attribute (tree * pnode, tree name, tree args, int flags,
a function global scope, unless declared static. */
if (current_function_decl != NULL_TREE && !TREE_STATIC (node))
TREE_PUBLIC (node) = 1;
- /* Clear TREE_STATIC because DECL_EXTERNAL is set. */
- TREE_STATIC (node) = 0;
+ /* Clear TREE_STATIC because DECL_EXTERNAL is set, unless
+ it is a C++ static data member. */
+ if (DECL_CONTEXT (node) == NULL_TREE
+ || !RECORD_OR_UNION_TYPE_P (DECL_CONTEXT (node)))
+ TREE_STATIC (node) = 0;
}
if (*no_add_attrs == false)