Commit b970a21d by Mark Mitchell Committed by Mark Mitchell

mangle.c (write_type): Don't use TYPE_MAIN_VARIANT when writing out an array type.

	* mangle.c (write_type): Don't use TYPE_MAIN_VARIANT when writing
	out an array type.
	(write_CV_qualifiers_for_type): Use TYPE_QUALS, not cp_type_quals,
	to determine qualifiers.

From-SVN: r52749
parent a49cfba8
...@@ -1358,6 +1358,11 @@ write_type (type) ...@@ -1358,6 +1358,11 @@ write_type (type)
since both the qualified and uqualified types are substitution since both the qualified and uqualified types are substitution
candidates. */ candidates. */
write_type (TYPE_MAIN_VARIANT (type)); write_type (TYPE_MAIN_VARIANT (type));
else if (TREE_CODE (type) == ARRAY_TYPE)
/* It is important not to use the TYPE_MAIN_VARIANT of TYPE here
so that the cv-qualification of the element type is available
in write_array_type. */
write_array_type (type);
else else
{ {
/* See through any typedefs. */ /* See through any typedefs. */
...@@ -1404,10 +1409,6 @@ write_type (type) ...@@ -1404,10 +1409,6 @@ write_type (type)
write_nested_name (TYPE_STUB_DECL (type)); write_nested_name (TYPE_STUB_DECL (type));
break; break;
case ARRAY_TYPE:
write_array_type (type);
break;
case POINTER_TYPE: case POINTER_TYPE:
/* A pointer-to-member variable is represented by a POINTER_TYPE /* A pointer-to-member variable is represented by a POINTER_TYPE
to an OFFSET_TYPE, so check for this first. */ to an OFFSET_TYPE, so check for this first. */
...@@ -1474,19 +1475,23 @@ write_CV_qualifiers_for_type (type) ...@@ -1474,19 +1475,23 @@ write_CV_qualifiers_for_type (type)
"In cases where multiple order-insensitive qualifiers are "In cases where multiple order-insensitive qualifiers are
present, they should be ordered 'K' (closest to the base type), present, they should be ordered 'K' (closest to the base type),
'V', 'r', and 'U' (farthest from the base type) ..." */ 'V', 'r', and 'U' (farthest from the base type) ..."
Note that we do not use cp_type_quals below; given "const
int[3]", the "const" is emitted with the "int", not with the
array. */
if (CP_TYPE_RESTRICT_P (type)) if (TYPE_QUALS (type) & TYPE_QUAL_RESTRICT)
{ {
write_char ('r'); write_char ('r');
++num_qualifiers; ++num_qualifiers;
} }
if (CP_TYPE_VOLATILE_P (type)) if (TYPE_QUALS (type) & TYPE_QUAL_VOLATILE)
{ {
write_char ('V'); write_char ('V');
++num_qualifiers; ++num_qualifiers;
} }
if (CP_TYPE_CONST_P (type)) if (TYPE_QUALS (type) & TYPE_QUAL_CONST)
{ {
write_char ('K'); write_char ('K');
++num_qualifiers; ++num_qualifiers;
......
2002-04-24 Mark Mitchell <mark@codesourcery.com> 2002-04-24 Mark Mitchell <mark@codesourcery.com>
* g++.dg/abi/mange7.C: New test.
PR c++/6438. PR c++/6438.
* g++.dg/parse/stmtexpr2.C: New test. * g++.dg/parse/stmtexpr2.C: New test.
......
/* { dg-do compile } */
typedef void *const t1[2];
float const f1(t1 (&)[79], ...) {}
/* { dg-final { scan-assembler _Z2f1RA79_A2_KPvz } } */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment