aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/semantics.c
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2019-03-27 16:39:19 -0400
committerJason Merrill <jason@gcc.gnu.org>2019-03-27 16:39:19 -0400
commitdd03c093bcc932fa7ec09e2f0e5662f6d8f429db (patch)
tree251e708b448eecbb80af1b26733466be5475b1e3 /gcc/cp/semantics.c
parentfad170232ce3b8c7a7743cc5a6031932257c9720 (diff)
downloadgcc-dd03c093bcc932fa7ec09e2f0e5662f6d8f429db.zip
gcc-dd03c093bcc932fa7ec09e2f0e5662f6d8f429db.tar.gz
gcc-dd03c093bcc932fa7ec09e2f0e5662f6d8f429db.tar.bz2
PR c++/89831 - error with qualified-id in const member function.
Since the fix for 15272 we were remembering the wrong function to use at instantiation time, because the type of the SCOPE_REF didn't reflect the cv-quals of 'this'. Conveniently, we can fix this by simplifying the code. * semantics.c (finish_non_static_data_member): Use object cv-quals in scoped case, too. From-SVN: r269977
Diffstat (limited to 'gcc/cp/semantics.c')
-rw-r--r--gcc/cp/semantics.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index fea2696..a08a2a5 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -1861,7 +1861,7 @@ finish_non_static_data_member (tree decl, tree object, tree qualifying_scope)
if (current_class_ptr)
TREE_USED (current_class_ptr) = 1;
- if (processing_template_decl && !qualifying_scope)
+ if (processing_template_decl)
{
tree type = TREE_TYPE (decl);
@@ -1882,17 +1882,16 @@ finish_non_static_data_member (tree decl, tree object, tree qualifying_scope)
type = cp_build_qualified_type (type, quals);
}
- ret = (convert_from_reference
- (build_min (COMPONENT_REF, type, object, decl, NULL_TREE)));
+ if (qualifying_scope)
+ /* Wrap this in a SCOPE_REF for now. */
+ ret = build_qualified_name (type, qualifying_scope, decl,
+ /*template_p=*/false);
+ else
+ ret = (convert_from_reference
+ (build_min (COMPONENT_REF, type, object, decl, NULL_TREE)));
}
/* If PROCESSING_TEMPLATE_DECL is nonzero here, then
- QUALIFYING_SCOPE is also non-null. Wrap this in a SCOPE_REF
- for now. */
- else if (processing_template_decl)
- ret = build_qualified_name (TREE_TYPE (decl),
- qualifying_scope,
- decl,
- /*template_p=*/false);
+ QUALIFYING_SCOPE is also non-null. */
else
{
tree access_type = TREE_TYPE (object);