diff options
author | Jakub Jelinek <jakub@redhat.com> | 2016-10-14 21:00:38 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2016-10-14 21:00:38 +0200 |
commit | 064ed55a66a788b1939fb93bd64ea3705e8384c7 (patch) | |
tree | a3cad8dde2b843cd8aa2efd08bfda9680d92d4a5 /gcc/cp | |
parent | 2579762a4b1979d894d489f72060f4b39fcdd1c6 (diff) | |
download | gcc-064ed55a66a788b1939fb93bd64ea3705e8384c7.zip gcc-064ed55a66a788b1939fb93bd64ea3705e8384c7.tar.gz gcc-064ed55a66a788b1939fb93bd64ea3705e8384c7.tar.bz2 |
DR 1511 - const volatile variables and ODR
DR 1511 - const volatile variables and ODR
* decl.c (grokvardecl): Change flags argument to type_quals,
add conceptp argument. Set TREE_PUBLIC for non-static volatile vars.
(grokdeclarator): Adjust grokvardecl caller.
* g++.dg/DRs/dr1511-1.C: New test.
* g++.dg/DRs/dr1511-2.C: New test.
From-SVN: r241176
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/cp/decl.c | 13 |
2 files changed, 15 insertions, 5 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index cc16176..cdc5aff 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,10 @@ +2016-10-14 Jakub Jelinek <jakub@redhat.com> + + DR 1511 - const volatile variables and ODR + * decl.c (grokvardecl): Change flags argument to type_quals, + add conceptp argument. Set TREE_PUBLIC for non-static volatile vars. + (grokdeclarator): Adjust grokvardecl caller. + 2016-10-13 Martin Sebor <msebor@redhat.com> PR c++/71912 diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index f761d0d..d70d583 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -68,7 +68,7 @@ static int unary_op_p (enum tree_code); static void push_local_name (tree); static tree grok_reference_init (tree, tree, tree, int); static tree grokvardecl (tree, tree, tree, const cp_decl_specifier_seq *, - int, int, int, int, tree); + int, int, int, bool, int, tree); static int check_static_variable_definition (tree, tree); static void record_unknown_type (tree, const char *); static tree builtin_function_1 (tree, tree, bool); @@ -8512,8 +8512,9 @@ grokvardecl (tree type, tree orig_declarator, const cp_decl_specifier_seq *declspecs, int initialized, - int flags, + int type_quals, int inlinep, + bool conceptp, int template_count, tree scope) { @@ -8522,8 +8523,8 @@ grokvardecl (tree type, gcc_assert (!name || identifier_p (name)); - bool constp = flags&1; - bool conceptp = flags&2; + bool constp = (type_quals & TYPE_QUAL_CONST) != 0; + bool volatilep = (type_quals & TYPE_QUAL_VOLATILE) != 0; /* Compute the scope in which to place the variable, but remember whether or not that scope was explicitly specified by the user. */ @@ -8580,6 +8581,7 @@ grokvardecl (tree type, TREE_PUBLIC (decl) = (declspecs->storage_class != sc_static && (DECL_THIS_EXTERN (decl) || ! constp + || volatilep || inlinep)); TREE_STATIC (decl) = ! DECL_EXTERNAL (decl); } @@ -11626,8 +11628,9 @@ grokdeclarator (const cp_declarator *declarator, decl = grokvardecl (type, dname, unqualified_id, declspecs, initialized, - ((type_quals & TYPE_QUAL_CONST) != 0) | (2 * concept_p), + type_quals, inlinep, + concept_p, template_count, ctype ? ctype : in_namespace); if (decl == NULL_TREE) |