mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-03-20 09:20:42 +08:00
* semantics.c (sort_constexpr_mem_initializers): Tweak.
From-SVN: r191139
This commit is contained in:
parent
d75171f35f
commit
091871eadd
@ -1,3 +1,7 @@
|
||||
2012-09-07 Jason Merrill <jason@redhat.com>
|
||||
|
||||
* semantics.c (sort_constexpr_mem_initializers): Tweak.
|
||||
|
||||
2012-09-09 Mark Kettenis <kettenis@openbsd.org>
|
||||
|
||||
* decl.c (reshape_init_class): Avoid dereferencing a
|
||||
|
@ -5903,24 +5903,26 @@ check_constexpr_ctor_body (tree last, tree list)
|
||||
static VEC(constructor_elt,gc) *
|
||||
sort_constexpr_mem_initializers (tree type, VEC(constructor_elt,gc) *vec)
|
||||
{
|
||||
if (!CLASSTYPE_HAS_PRIMARY_BASE_P (type)
|
||||
|| (CLASSTYPE_PRIMARY_BINFO (type)
|
||||
== BINFO_BASE_BINFO (TYPE_BINFO (type), 0)))
|
||||
tree pri = CLASSTYPE_PRIMARY_BINFO (type);
|
||||
constructor_elt elt;
|
||||
int i;
|
||||
|
||||
if (pri == NULL_TREE
|
||||
|| pri == BINFO_BASE_BINFO (TYPE_BINFO (type), 0))
|
||||
return vec;
|
||||
|
||||
/* Find the element for the primary base and move it to the beginning of
|
||||
the vec. */
|
||||
tree pri = BINFO_TYPE (CLASSTYPE_PRIMARY_BINFO (type));
|
||||
VEC(constructor_elt,gc) &v = *vec;
|
||||
int pri_idx;
|
||||
|
||||
for (pri_idx = 1; ; ++pri_idx)
|
||||
if (TREE_TYPE (v[pri_idx].index) == pri)
|
||||
pri = BINFO_TYPE (pri);
|
||||
for (i = 1; ; ++i)
|
||||
if (TREE_TYPE (v[i].index) == pri)
|
||||
break;
|
||||
constructor_elt pri_elt = v[pri_idx];
|
||||
for (int i = 0; i < pri_idx; ++i)
|
||||
v[i+1] = v[i];
|
||||
v[0] = pri_elt;
|
||||
|
||||
elt = v[i];
|
||||
for (; i > 0; --i)
|
||||
v[i] = v[i-1];
|
||||
v[0] = elt;
|
||||
return vec;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user