summaryrefslogtreecommitdiff
path: root/gcc/cp/decl.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cp/decl.c')
-rw-r--r--gcc/cp/decl.c25
1 files changed, 5 insertions, 20 deletions
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 1ef97637426..1f22c265b8c 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -8131,7 +8131,6 @@ build_ptrmemfunc_type (tree type)
{
tree field, fields;
tree t;
- tree unqualified_variant = NULL_TREE;
if (type == error_mark_node)
return type;
@@ -8145,9 +8144,11 @@ build_ptrmemfunc_type (tree type)
/* Make sure that we always have the unqualified pointer-to-member
type first. */
- if (cp_type_quals (type) != TYPE_UNQUALIFIED)
- unqualified_variant
- = build_ptrmemfunc_type (TYPE_MAIN_VARIANT (type));
+ if (cp_cv_quals quals = cp_type_quals (type))
+ {
+ tree unqual = build_ptrmemfunc_type (TYPE_MAIN_VARIANT (type));
+ return cp_build_qualified_type (unqual, quals);
+ }
t = make_node (RECORD_TYPE);
@@ -8168,22 +8169,6 @@ build_ptrmemfunc_type (tree type)
information for this anonymous RECORD_TYPE. */
TYPE_NAME (t) = NULL_TREE;
- /* If this is not the unqualified form of this pointer-to-member
- type, set the TYPE_MAIN_VARIANT for this type to be the
- unqualified type. Since they are actually RECORD_TYPEs that are
- not variants of each other, we must do this manually.
- As we just built a new type there is no need to do yet another copy. */
- if (cp_type_quals (type) != TYPE_UNQUALIFIED)
- {
- int type_quals = cp_type_quals (type);
- TYPE_READONLY (t) = (type_quals & TYPE_QUAL_CONST) != 0;
- TYPE_VOLATILE (t) = (type_quals & TYPE_QUAL_VOLATILE) != 0;
- TYPE_RESTRICT (t) = (type_quals & TYPE_QUAL_RESTRICT) != 0;
- TYPE_MAIN_VARIANT (t) = unqualified_variant;
- TYPE_NEXT_VARIANT (t) = TYPE_NEXT_VARIANT (unqualified_variant);
- TYPE_NEXT_VARIANT (unqualified_variant) = t;
- }
-
/* Cache this pointer-to-member type so that we can find it again
later. */
TYPE_SET_PTRMEMFUNC_TYPE (type, t);