diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2008-01-14 19:32:10 +0000 |
---|---|---|
committer | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2008-01-14 19:32:10 +0000 |
commit | 052cec9b0e00300eb75e6712cb82ad1e9d4ba3b4 (patch) | |
tree | 8cc6a97b41802b07368b171b5eddc2d051a9c406 /gcc/ada/trans.c | |
parent | 8103eebfb73229a018f22718665864730e43c58f (diff) | |
download | gcc-052cec9b0e00300eb75e6712cb82ad1e9d4ba3b4.zip gcc-052cec9b0e00300eb75e6712cb82ad1e9d4ba3b4.tar.gz gcc-052cec9b0e00300eb75e6712cb82ad1e9d4ba3b4.tar.bz2 |
decl.c (gnat_to_gnu_entity): Process renamings before converting the expression to the type of the object.
* decl.c (gnat_to_gnu_entity) <object>: Process renamings
before converting the expression to the type of the object.
* trans.c (maybe_stabilize_reference) <CONSTRUCTOR>: New case.
Stabilize constructors for special wrapping types.
From-SVN: r131531
Diffstat (limited to 'gcc/ada/trans.c')
-rw-r--r-- | gcc/ada/trans.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/gcc/ada/trans.c b/gcc/ada/trans.c index c5828d7..5b04972 100644 --- a/gcc/ada/trans.c +++ b/gcc/ada/trans.c @@ -6503,6 +6503,28 @@ maybe_stabilize_reference (tree ref, bool force, bool *success) result = gnat_stabilize_reference_1 (ref, force); break; + case CONSTRUCTOR: + /* Constructors with 1 element are used extensively to formally + convert objects to special wrapping types. */ + if (TREE_CODE (type) == RECORD_TYPE + && VEC_length (constructor_elt, CONSTRUCTOR_ELTS (ref)) == 1) + { + tree index + = VEC_index (constructor_elt, CONSTRUCTOR_ELTS (ref), 0)->index; + tree value + = VEC_index (constructor_elt, CONSTRUCTOR_ELTS (ref), 0)->value; + result + = build_constructor_single (type, index, + gnat_stabilize_reference_1 (value, + force)); + } + else + { + *success = false; + return ref; + } + break; + case ERROR_MARK: ref = error_mark_node; |